Pointer - Call-by-reference cont.
/* Must use Call-by-reference/address */
#include <stdio.h>
void swap(int *, int *);
main()
{ int a = 3, b = 7;
printf("%d %d\n", a, b); /* 3 7 is printed */
swap(&a, &b);
printf("%d %d\n", a, b); /* 7 3 is printed */}
void swap(int *p, int *q)
{ int tmp;
tmp = *p; *p = *q; *q = tmp; }