Mega Code Archive
Categories
/
C
/
Code Snippets
Variable scopeinside a function
#include
int main(void) { int j; j = 10; if(j == 10) { int j; /* this j hides the outer j */ j = 99; printf("Inner j: %d\n", j); } printf("Outer j: %d\n", j); return 0; }