Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void square(int& a)
- {
- a = a * a;
- return;
- }
- //THIS IS AN EXAMPLE OF FAILURE.
- /*
- int main()
- {
- int x = 1;
- int y = 2;
- square(x + y);
- cout << x;
- return 0;
- }
- */
- int main()
- {
- int x = 1;
- int y = 2;
- int z = x + y;
- square(z);
- cout << x;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement