I have been struggling to understand the different behaviour when swapping pointers in C. If I want to swap two int pointers, then I can do
int
void
If you have the luxury of working in C++, use this:
template void swapPrimitives(T& a, T& b) { T c = a; a = b; b = c; }
Granted, in the case of char*, it would only swap the pointers themselves, not the data they point to, but in most cases, that is OK, right?
char*