#include <iostream>
void MySwap( int *p1, int *p2 )
{
int temp = *p1; // Store value stored in location p1 is pointing to into temp
*p1 = *p2; // Store value stored in location p2 is pointing to into location p1 is pointing to
*p2 = temp; // Store value of temp in location p2 is pointing to
}
int main( int argc, char* argv[] )
{
int a = 1, b = 2;
std::cout << "a is " << a << ", b is " << b << std::endl;
MySwap( &a, &b );
std::cout << "a is " << a << ", b is " << b << std::endl;
}