fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int& f( int& v )
  5. {
  6. v *= 2;
  7. return v;
  8. }
  9.  
  10. int main() {
  11.  
  12. int i = 10;
  13. f(i) = f(i) + 42;
  14. cout << "i=" << i << endl;
  15.  
  16. int j = 10;
  17. f(j) += 42;
  18. cout << "j=" << j << endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
i=82
j=62