#include using namespace std; // Works in C // In this version, we pass an address void swap(int *a, int *b){ int t = *a; *a = *b; *b = t; } // Does not work in C // This is pass by reference void swap_cpp_only(int &a, int &b){ int t = a; a = b; b = t; } int main(){ int x = 24, y = 425; cout << "x = " << x << endl; cout << "y = " << y << endl; swap(x, y); cout << "After swap: " << endl; cout << "x = " << x << endl; cout << "y = " << y << endl; return 0; }