How can one swap pointer addresses within a function with a signature?
Let’s say:
int weight, height;
void swap(int* a, int* b);
So after going out of this function the addresses of the actual parameters (weight and height) would be changed. Is it possible at all?
If you want to swap the addresses that the pointers are pointing to, not just the values stored at that address, you’ll need to pass the pointers by reference (or pointer to pointer).
Or you can use the STL swap function and pass it the pointers.
Your question doesn’t seem very clear, though.