#include void swap(int a,int b) { int temp; temp=a; a=b; b=temp; } void swapa(int *pa,int *pb) { int temp; temp=*pa; *pa=*pb; *pb=temp; } void swapr(int& a,int& b) // Does not work in C { int temp; // but works in C++ temp=a; a=b; b=temp; } void passp(int a[]) { int temp; temp=a[0]; a[0]=a[1]; a[1]=temp; } int main(void) { int a,b,c[2]; a=3; b=5; swap(a,b); printf("After swap: a is %d b is %d\n",a,b); swapa(&a,&b); printf("After swapa: a is %d b is %d\n",a,b); swapr(a,b); printf("After swapr: a is %d b is %d\n",a,b); c[0]=0; c[1]=1; passp(c); printf("After passp: c[0] is %d c[1] is %d\n",c[0],c[1]); }