#include <stdio.h>
int main()
{
int x= 3; /* variable declaration in outer block */
printf("\n in outer block x = %d before executing inner block ", x);
{
int x= 45; /* variable declaration in inner block */
printf("\n in inner block x = %d", x);
}
printf("\n in outer block x = %d after executing inner block ", x);
return 0;
}
in outer block x = 3 before executing inner block
in inner block x = 45
in outer block x = 3 after executing inner block
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.