Suppose the following minimal code:
#include
char character = \'c\';
int main (void)
{
char character = \'b\';
printf(\"The current value
After the declaration of character
in main
, any reference to character
in that function refers to that one, not the one at global scope. We call this shadowing.
As for the effect on memory, you can't say due to the as-if rule adopted by the language: a compiler might optimise to
#include
int main()
{
printf("The current value of head is b");
}
for example.