Advertisement
dllbridge

Untitled

Aug 19th, 2024
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 KB | None | 0 0
  1. //  C lang  //
  2.  
  3.  
  4.  
  5. #include        <stdio.h>
  6. #include       <stdlib.h>
  7.  
  8. int n;
  9.  
  10.  
  11. ////////////////////////////////////////////////////
  12. int main()                                        //
  13. {
  14.  
  15.     int n2;
  16.    
  17.     int *p = (int*)malloc(4);
  18.        
  19.     printf(" p = %d\n",  p);
  20.     printf("&p = %d\n", &p);  
  21.    
  22.    *p = 16;
  23.    
  24.     printf("*p = %d\n", *p);   
  25. }
  26.  
  27.  
  28.  
  29. //  C++ lang   //
  30.  
  31.  
  32.  
  33. #include        <stdio.h>
  34. #include       <stdlib.h>
  35.  
  36. __int64 n;
  37.  
  38.  
  39. ////////////////////////////////////////////////////
  40. int main()                                        //
  41. {
  42.  
  43.     int n2;
  44.    
  45.     int *p = (int*)malloc(sizeof(int));
  46.        
  47.     printf(" p = %d\n",  p);
  48.     printf("&p = %d\n", &p);  
  49.    
  50.    *p = 16;
  51.    
  52.     int &a = *p;
  53.    
  54.     printf("*p = %d\n", *p);   
  55.     printf("*p = %d\n",  a);      
  56. }
  57.  
  58.  
  59.  
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement