#include #include // This code does not work. You can't swap values inside a function and // propagate the result back to the calling function without using pointers. void swap(int a, int b) { printf("\t[swap] Before a=%d, b=%d \n", a, b); int temp; temp=b; b=a; a=temp; printf("\t[swap] After a=%d, b=%d \n", a, b); } int main() { int a=5; int b=8; printf("[main] Before a=%d, b=%d \n", a, b); swap(a, b); printf("[main] After a=%d, b=%d \n", a, b); system("pause"); }