Advertisement
dllbridge

Untitled

Jan 25th, 2025
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1.  
  2. #include  <iostream>
  3. #include    <string>
  4. using namespace std;
  5.  
  6.  
  7. /////////////////////////////////
  8. int main()                    //
  9. {
  10.  
  11.     setlocale(LC_ALL, "rus");
  12.    
  13.    
  14.     int  n =  9;
  15.     int *p = &n;
  16.    
  17.     p = new int;
  18.    
  19.    *p = 421;
  20.    
  21.     cout <<"Size of *p = " << sizeof *p  << endl;
  22.     cout <<"         p = " <<         p  << endl;
  23.     cout <<"        *p = " <<        *p  << endl;  
  24.    
  25.     int &r = *p;
  26.    
  27.     cout <<"         r = " <<         r  << endl;  
  28.     cout <<"        &r = " <<        &r  << endl;        
  29.     cout <<"Address  n = " <<        &n  << endl;
  30.  
  31.     cout <<"Address  p = " <<        &p  << endl;  
  32.          
  33.     delete p;    
  34. }
  35.  
  36.  
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement