Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n = 8;
- int *p = &n;
- int &r = n;
- ///////////////////////////////////////////////////////
- int main()
- {
- cout << r;
- return 0;
- }
- /*
- #include <iostream>
- using namespace std;
- void foo(int*);
- ///////////////////////////////////////////////////////
- int main()
- {
- int n = 53;
- foo(&n);
- cout << "n = "<< n << endl;
- return 0;
- }
- //////////////////////////////////////////////////////////
- void foo(int *p)
- {
- cout << " p = "<< p << endl;
- cout << "*p = "<< *p << endl;
- *p = 8;
- cout << "*p = "<< *p << endl;
- }
- */
- /*
- #include <iostream>
- using namespace std;
- int foo();
- int n = 74;
- ///////////////////////////////////////////////////////
- int main()
- {
- setlocale(LC_ALL, "rus");
- n = foo();
- cout << "global address n = "<< &n << endl;
- return 0;
- }
- //////////////////////////////////////////////////////////
- int foo()
- {
- int n = 8;
- cout << " Local address n = "<< & n << endl;
- cout << "global address n = "<< &(::n) << endl;
- return n + 10;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement