/* Program to illustrate resolution of name references in programs with functions, value parameters, and local parameters */ #include /* global variables */ int a = 1000; int b = 4000; int c = 7000; /* procedure declarations note: main calls proc2 which calls proc1 */ void proc1 (int b) { int a = c; printf ("proc1-1 a:%4d, b:%4d, c:%4d\n", a, b, c); b = 600; c = 800; printf ("proc1-2 a:%4d, b:%4d, c:%4d\n", a, b, c); } void proc2 (int b, int c) { printf ("proc2-1 a:%4d, b:%4d, c:%4d\n", a, b, c); a = 300; b = 500; proc1(a); printf ("proc2-2 a:%4d, b:%4d, c:%4d\n", a, b, c); } int main () { int a; printf ("main-1 a:%4d, b:%4d, c:%4d\n", a, b, c); a = 2000; proc2(a, b); printf ("main-2 a:%4d, b:%4d, c:%4d\n", a, b, c); return 0; }