What does the following code write to the monitor?
#include <stdio.h>
int main( void )
{
int a = 1;
int b = 2;
printf("main : a=%d\tb=%d\n", a, b );
{
int b = 3;
printf("block1 : a=%d\tb=%d\n", a, b );
}
{
printf("block2s: a=%d\tb=%d\n", a, b );
int a = 4;
printf("block2e: a=%d\tb=%d\n", a, b );
}
printf("main : a=%d\tb=%d\n", a, b );
return 0;
}
Here, there are two sequential inner blocks, each with a declaration of a variable. All variables in this program have block scope, but different variables have scope within different blocks.