fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void swap (int *a, int *b){
  5. cout << "my swap called\n"; // Note that this is not in the output.
  6. *a = *b;
  7. }
  8.  
  9. int main(){
  10. int x = 1;
  11. int y = 2;
  12. swap(x,y);
  13. cout << "x=" << x << ", y=" << y << "\n";
  14. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
x=2, y=1