Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void foo(int x, int y) {
- x = 3;
- cout << "1: " << x * y << endl;
- }
- void bar(int & x, int & y) {
- x = 3;
- cout << "2: " << x * y << endl;
- }
- int main(int argc, char **argv) {
- int a,b;
- a = 2;
- b = 2;
- foo(a,a);
- bar(b,b);
- cout << "end: " << a << "," << b << endl;
- return 0;
- }
- // Lala:Desktop jeena$ ./a.out
- // 1: 6
- // 2: 9
- // end: 2,3
Add Comment
Please, Sign In to add comment