/* File: swap3.c What happens if you forget the &? */ #include void swap(int *ptr1, int *ptr2) ; int main() { int a, b ; a = 79 ; b = 42 ; printf("a = %d, b = %d\n", a, b) ; swap(a, b) ; printf("a = %d, b = %d\n", a, b) ; return 0 ; } /* function: swap(a,b) exchanges the values stored in a & b. */ void swap(int *ptr1, int *ptr2) { int temp; printf("ptr1 = %p, *ptr1 = %d\n", ptr1, *ptr1) ; printf("ptr2 = %p, *ptr2 = %d\n", ptr2, *ptr2) ; temp = *ptr1 ; *ptr1 = *ptr2 ; *ptr2 = temp ; return ; }