fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void swap(int* a, int* b) {
  5. int c = *a;
  6. *a = *b;
  7. *b = c;
  8. }
  9.  
  10. int main() {
  11. int x = 10, y = 20;
  12. swap(&x, &y);
  13. cout << x << " " << y << endl;
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
20 10