You definitely need a temporary variable for the swap. Here's why.
First of all, here's what your code is doing.
Code:
// *ptrA = 1, *ptrB = 2
*ptrA = *ptrB;
// *ptrA = 2, *ptrB = 2
*ptrB = *ptrA;
// *ptrA = 2, *ptrB = 2
As you can see, the value of ptra is lost in the first step. You need to save the value of ptrA, and assign it to ptrB in the last step. Something like this.
Code:
// *ptrA = 1, *ptrB = 2, temp = undefined
temp = *ptrA;
// *ptrA = 1, *ptrB = 2, temp = 1
*ptrA = *ptrB;
// *ptrA = 2, *ptrB = 2, temp = 1
*ptrB = temp;
// *ptrA = 2, *ptrB = 1, temp = 1