/* * function2.c * basic concepts of functions -- addresses */ #include int a; // global variable, visible from anywhere. int add(int x, int y) { int z = 1;//local variable printf("Address of parameter x is %lu\n", &x); printf("Address of parameter y is %lu\n", &y); printf("Address of local variable z is %lu\n", &z); return x+y+z; } void main() { a = 1; int b = 2; int y = add(a, b); printf("Address of a is %lu\n", &a); printf("Address of b is %lu\n", &b); printf("Address of y is %lu\n", &y); } /* program output (system dependent) Address of parameter x is 6422256 Address of parameter y is 6422260 Address of local variable z is 6422236 Address of a is 4214888 Address of b is 6422284 Address of y is 6422280 */