#include #include /**** * * Implementation and testing a C function that exchanges the value of two * integer variables. It illustrates the concept of formal output parameters, * covered in Section 6.4 of the book. * */ void exchange(int *x, int *y) { int tmp; /* Hold the value of x temporarily */ tmp = *x; *x = *y; *y = tmp; } int main() { int i = 10; int j = 20; printf("i,j before exchange = %d,%d\n", i, j); exchange(&i, &j); printf("i,j after exchange = %d,%d\n", i, j); return 0; }