[dywang@deyu zzz]$ cat function2.c
#include <stdio.h>
void swap(int x, int y) {
int temp;
temp = x;
x = y;
y = temp;
return;
}
main() {
int a, b;
printf("Enter TWO integers: ");
scanf("%d %d", &a, &b);
printf("Before swap, a = %d, b = %d\n", a, b);
swap(a, b);
printf("After swap, a = %d, b = %d\n", a, b);
}
[dywang@deyu zzz]$ gcc -o function2 function2.c
[dywang@deyu zzz]$ ./function2 Enter TWO integers: 10 20 Before swap, a = 10, b = 20 After swap, a = 10, b = 20