... swap(&p, &q); ...
Q: How must swap be changed?
void swap(int* a, int* b) { int temp = *a; *a = *b; *b = temp; }
However, this only simulates call by reference; true call by reference allows the call
... swap(p, q); ...