C++ Function return statement Returning reference values
#include <iostream> using namespace std; int x; // global variable int& setx(); // function declaration int main()/* ww w . j a v a 2 s .c o m*/ { // set x to a value, using setx() = 92; // function call on left side cout << "x=" << x << endl; // display new value in x return 0; } int& setx() { return x; // returns the value to be modified }