// Demonstrates parameter passing in C // Compile: gcc -o swaptest swaptest.c // Execute: swaptest // #include int main(int argc, char *argv[]) { // params are pass by value void swap(int x, int y) { int t = x; x = y; y = t; } printf("swaptest1.c, by value"); int a = 1; int b = 2; printf("%d, %d\n", a, b); swap(a, b); printf("%d, %d\n", a, b); }