#include<stdio.h>
void exchange(void);
int a, b; /* declaration of global variables */
int main()
{ /* main program starts here...*/
a = 5;
b = 7;
printf(" In main: a = %d, b = %d\n", a, b);
exchange(); /* function call, no parameters are passed */
printf("\n Back in main: ");
printf("a = %d, b = %d\n", a, b);
return 0;
} /* main program ends here */
void exchange(void)
{ /* function body starts here...*/
int temp; /* decl. of local variable in function*/
printf("\n In function exchange() before change: just received from\
main... a=%d and b=%d",a,b);
temp = a;
a = b;
b = temp; /* interchange over */
printf("\n In function exchange() after change: ");
printf("a = %d, b = %d\n", a, b);
} /* function body ends here*/