fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void myswap(int*a, int* b) {
  5. *a = *b;
  6. }
  7.  
  8. int main() {
  9. int x=1, y=2;
  10. myswap(x,y);
  11. cout << "x=" << x << ", y=" << y << '\n' ;
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:10:15: error: invalid conversion from 'int' to 'int*' [-fpermissive]
     myswap(x,y);
               ^
prog.cpp:4:6: note:   initializing argument 1 of 'void myswap(int*, int*)'
 void myswap(int*a, int* b) {
      ^
prog.cpp:10:15: error: invalid conversion from 'int' to 'int*' [-fpermissive]
     myswap(x,y);
               ^
prog.cpp:4:6: note:   initializing argument 2 of 'void myswap(int*, int*)'
 void myswap(int*a, int* b) {
      ^
stdout
Standard output is empty