fork(2) download
  1. #include <stdio.h>
  2. using namespace std;
  3.  
  4. void swap(int &a, int &b){
  5. printf("%d %d\n", a, b);
  6. printf("%d %d\n", &a, &b);
  7.  
  8. int temp=a;
  9. a=b;
  10. b=temp;
  11. }
  12.  
  13. int main(void) {
  14. int a=2, b=5;
  15. printf("%d %d\n", a, b);
  16. printf("%d %d\n", &a, &b);
  17.  
  18. swap(a,b);
  19. printf("%d %d\n", a, b);
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
2 5
-1076828408 -1076828404
2 5
-1076828408 -1076828404
5 2