#include /* * Example program that demonstrates that only the * values are passed to parameters and the original * variable does not change. * 06.20.05 * Sara Sprenkle */ /* * Swap the values in x and y (does not affect * values in calling function) */ void swap( int x, int y ) { int temp = x; x = y; y = temp; printf("x is %d\n", x ); printf("y is %d\n", y ); /* return is not required */ } int main() { int x, y; printf("Enter two numbers: "); scanf("%d %d", &x, &y); printf("Before swap:\n"); printf("x is %d\n", x ); printf("y is %d\n", y ); swap( x, y ); printf("After swap:\n"); printf("x is %d\n", x ); printf("y is %d\n", y ); }