fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. //tmp() меняет местами
  4. int* tmp(int &a, int &b)
  5. {
  6. int tmp;
  7. tmp = a;
  8. a = b;
  9. b = tmp;
  10. return &a;//специально возвращаю адрес
  11. }
  12. void main(){
  13. int i,j;
  14. i=5;
  15. j=10;
  16. printf("i = %d \n",*tmp(i,j));
  17. printf("i = %d, j = %d \n", i, j);
  18. system("pause");
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:4:14: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
 int* tmp(int &a, int &b)
              ^
prog.c:12:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
 void main(){
      ^
prog.c: In function ‘main’:
prog.c:16:5: warning: implicit declaration of function ‘tmp’ [-Wimplicit-function-declaration]
     printf("i = %d \n",*tmp(i,j));
     ^
prog.c:16:24: error: invalid type argument of unary ‘*’ (have ‘int’)
     printf("i = %d \n",*tmp(i,j));
                        ^
stdout
Standard output is empty