#include <string.h>
#include <stdio.h>

/****
 *
 * Implementation and testing a C function that wants to exchange the value of
 * two integer variables.  Unfortunately, this function does not work as
 * intended.  See the file exchange.c for a version that does work.
 *
 */

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;
}