// Swap in c++ // Compile with g++ -o swaptest1 swaptest1.cpp #include using namespace std; // Pass the params by calue void swap(int x, int y) { int t = x; x = y; y = t; } int main() { cout << "C++ by value" << endl; int a = 1; int b = 2; cout << a << b << endl; swap(a, b); // Address of param is passed cout << a << b << endl; }