#include <stdio.h> void swap(int & x, int & y) { int z = x; x = y; y = z; } int main() { int a = 0, b = 1; swap(a,b); printf("a is now %d\n", a); printf("b is now %d\n", b);}
Standard input is empty
prog.c:3:15: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token void swap(int & x, int & y) ^ prog.c: In function ‘main’: prog.c:12:5: warning: implicit declaration of function ‘swap’ [-Wimplicit-function-declaration] swap(a,b); ^~~~
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!