/* This program demonstrates the scope of variables. Gang Qu Sept. 1, 2015 */ #include int a=1; int b = 12; void showvalue(void); int main(void) { int i; for (i = 10; i <= b; i++) { a++; printf("in main(), a = %d, \n", a); showvalue(); } return 0; } void showvalue() { // try to add one of the commented statements and see what is the difference // int a = 3; static int a = 3; static int i = 0; a = a + b; printf("Times function is called: %d, a = %d\n", ++i, a); }