Advertisement
dllbridge

Untitled

May 5th, 2025
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.55 KB | None | 0 0
  1.  
  2. #include    <stdio.h>
  3. #include   <stdlib.h>
  4.  
  5.  
  6.  
  7.  
  8. ///////////////////////////////////////////////////
  9. int main()
  10. {
  11.    
  12.    
  13.    int n = 9;
  14.    
  15.    
  16.    int *p = (int*)malloc(4);
  17.    
  18.    *p = 897;
  19.    
  20.    printf("*p = %d\n",   *p);
  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    <stdio.h>
  45. #include   <stdlib.h>
  46. #include     <time.h>
  47.  
  48.  
  49. int nArr[20] = {123, 6, 54, 3, 676, 8, 3, 78, 9, 1};
  50.  
  51. int *p = &nArr[4];
  52.  
  53. ///////////////////////////////////////////////////
  54. int main()
  55. {
  56.    
  57.    
  58.     printf("time(0) = %d\n",   time(0));
  59.    
  60.    
  61.     srand(time(0));
  62.    
  63.     for(int i = 0; i < 20; i++)
  64.     {
  65.        
  66.         nArr[i] = rand();
  67.        
  68.     }
  69.    
  70.     printf("           nArr[4] = %d\n",   nArr[4]);
  71.     printf("Address of nArr[4] = %d\n",  &nArr[4]);
  72.     printf("                   = %d\n", *&nArr[4]);    
  73. }
  74.  
  75.  
  76.  
  77. */
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. /*
  91. #include   <stdio.h>
  92.  
  93.  
  94. int nArr[99] = {123, 6, 54, 3, 676, 8, 3, 78, 9, 1};
  95.  
  96. int *p = &nArr[4];
  97.  
  98. ///////////////////////////////////////////////////
  99. int main()
  100. {
  101.  
  102.     printf("           nArr[4] = %d\n",   nArr[4]);
  103.     printf("Address of nArr[4] = %d\n",  &nArr[4]);
  104.     printf("                   = %d\n", *&nArr[4]);    
  105.    
  106.    
  107.  
  108. }
  109.  
  110.   */
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121. /*
  122. #include   <stdio.h>
  123.  
  124.  
  125. int n = 123;
  126.  
  127. int *p = &n;
  128.  
  129. ///////////////////////////////////////////////////
  130. int main()
  131. {
  132.  
  133.  
  134.     printf(" = %d\n",    n);
  135.     printf(" = %d\n",   &n);  
  136.     printf(" = %d\n",  *&n);
  137.     printf(" = %d\n", &*&n);      
  138. }
  139.  
  140.  
  141.  
  142.  
  143. */
  144.  
  145.  
  146.  
  147.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement