What does the following code write to the monitor?
#include <stdio.h> int main( void ) { int a = 1; int b = 2; { int b = 3; printf("a=%d\tb=%d\n", a, b ); } printf("a=%d\tb=%d\n", a, b ); return 0; }
This program has a nested block inside the main block. At the beginning of
that nested block is a declaration of a variable, b
,
which has block scope
for that block.