SHARE
TWEET

ampersand

a guest Oct 14th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.     void square(int& a)
  5.         {
  6.         a = a * a;
  7.             return;
  8.         }
  9.  
  10. //THIS IS AN EXAMPLE OF FAILURE.
  11. /*
  12.     int main()
  13.     {
  14.         int x = 1;
  15.         int y = 2;
  16.         square(x + y);
  17.         cout << x;
  18.         return 0;
  19.     }
  20. */
  21.  
  22.     int main()
  23.     {
  24.         int x = 1;
  25.         int y = 2;
  26.         int z = x + y;
  27.         square(z);
  28.         cout << x;
  29.         return 0;
  30.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top