fork download
  1. #include <stdio.h>
  2.  
  3. void swap(int &a, int &b){
  4. printf("%d %d\n", a, b);
  5. printf("%d %d\n", &a, &b);
  6.  
  7. int temp=a;
  8. a=b;
  9. b=temp;
  10. }
  11.  
  12. int main(void) {
  13. int a=2, b=5;
  14. printf("%d %d\n", a, b);
  15. printf("%d %d\n", &a, &b);
  16.  
  17. swap(a,b);
  18. printf("%d %d\n", a, b);
  19. return 0;
  20. }
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:3:15: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
 void swap(int &a, int &b){
               ^
prog.c: In function ‘main’:
prog.c:15:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat=]
    printf("%d %d\n", &a, &b);
    ^
prog.c:15:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int *’ [-Wformat=]
prog.c:17:2: warning: implicit declaration of function ‘swap’ [-Wimplicit-function-declaration]
  swap(a,b);
  ^
stdout
Standard output is empty