Main.cc: In function 'int z(int&, int&)': Main.cc:9:22: error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int' else return z(b,a%b); ^ Main.cc:7:5: note: initializing argument 2 of 'int z(int&, int&)' int z(int &a,int &b){ ^