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