Advertisement
dllbridge

Untitled

Mar 4th, 2024
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.36 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6. int  n =  8;
  7. int *p = &n;
  8. int &r =  n;
  9.  
  10. ///////////////////////////////////////////////////////
  11. int main()                                      
  12. {
  13.  
  14.     cout << r;
  15.  
  16. return 0;
  17. }
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. /*
  44. #include <iostream>
  45. using namespace std;
  46.  
  47.  
  48. void foo(int*);
  49.  
  50.  
  51.  
  52. ///////////////////////////////////////////////////////
  53. int main()                                      
  54. {
  55.  
  56.    
  57.     int n = 53;
  58.    
  59.    
  60.     foo(&n);
  61.    
  62.     cout << "n = "<< n << endl;
  63.      
  64.    
  65.    
  66. return 0;
  67. }
  68.  
  69.  
  70.  
  71. //////////////////////////////////////////////////////////
  72. void foo(int *p)
  73. {
  74.  
  75.      cout << " p = "<<  p << endl;
  76.      cout << "*p = "<< *p << endl;
  77.     *p = 8;
  78.      cout << "*p = "<< *p << endl;
  79.    
  80. }
  81.  
  82.  
  83. */
  84.  
  85.  
  86.  
  87. /*
  88.  
  89. #include <iostream>
  90. using namespace std;
  91.  
  92.  
  93. int foo();
  94.  
  95. int n = 74;
  96.  
  97. ///////////////////////////////////////////////////////
  98. int main()                                      
  99. {
  100.  
  101.     setlocale(LC_ALL, "rus");  
  102.    
  103.     n = foo();
  104.    
  105.     cout << "global address n = "<< &n << endl;
  106.      
  107.    
  108.    
  109. return 0;
  110. }
  111.  
  112.  
  113.  
  114. //////////////////////////////////////////////////////////
  115. int foo()
  116. {
  117.  
  118.     int n = 8;
  119.  
  120.     cout << " Local address n = "<< &   n << endl;  
  121.     cout << "global address n = "<< &(::n) << endl;
  122. return n + 10;     
  123. }
  124.  
  125.  
  126.  
  127. */
  128.  
  129.  
  130.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement