fork download
  1. #include <iostream>
  2. using namespace std;
  3. // Function prototype
  4. void sqr(int&);
  5. int main()
  6. {
  7. int b = 2;
  8. cout << "Number before" << endl;
  9. cout << "Number = " << b << endl;
  10. sqr(b);
  11. cout << "\nAfter Square" << endl;
  12.  
  13. cout << "Number = " << b << endl;
  14. return 0;
  15. }
  16. void sqr(int& n1) {
  17. int temp;
  18. temp=n1*n1;
  19. }
Success #stdin #stdout 0s 4296KB
stdin
Standard input is empty
stdout
Number before
Number = 2

After Square
Number = 2