13.10) The Old C Approach: Pointers
void swap(int* x, int* y) { int tmp = *x; *x = *y; *y = temp; }
- No reference type in C, so instead we must declare the parameters as pointers
- When calling the function, we must remember to pass the addresses of variables as arguments, which we obtain with the & operator
- This approach works in C++, but should be avoided - references are a cleaner solution!