#include /* * Example program that demonstrates scope CISC 105 06.20.05 From Tan * & D'Orazio pages 291-292 * NOTE: THIS IS NOT GOOD PROGRAMMING STYLE */ /* Global variable, outside any function definition */ int m = 12; int function1( int a, int b, int c, int d); int main() { int n = 30; int e, f, g, h, i; e=1; f=2; g=3; h=4; /* Note how the string literal is broken up.*/ printf("\nBefore the call to function1, \n" "m = %d\n" "n = %d\n" "e = %d\n", m, n, e ); i = function1(e, f, g, h); printf("\nAfter the call to function1, \n" "m = %d\n" "n = %d\n" "e = %d\n", m, n, e ); return 0; } int function1( int a, int b, int c, int d ) { int n = 400; printf("\nIn function1, \n" "m = %d\n" "n = %d\n" "a = %d\n", m, n, a ); m = 999; if( a >= 1 ) { a += b+m+n; printf("m = %d after being modified\n", m); printf("a = %d after being modified\n", a); return a; } else { c += d+m+n; return c; } }