Advertisement
dllbridge

Untitled

Apr 26th, 2025
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.62 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6. #include    <stdio.h>
  7.  
  8.  
  9. double fArr[20] = {3.14, 3.2, 1.5};
  10.  
  11.  
  12.  
  13.  
  14.    
  15. /////////////////////////////////////////////////
  16. int main()
  17. {
  18.    
  19.     double *pf = &fArr[17];
  20.    
  21.    
  22.     printf("delta = %d\n",  pf - fArr);
  23.     printf("delta = %d\n", (pf - fArr) * sizeof(double));    
  24.     printf("delta = %d\n", (int*)pf - (int*)fArr);      
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. /*
  44.  
  45.  
  46. #include    <stdio.h>
  47. #include   <string.h>
  48.  
  49. double f = 3.14;
  50.  
  51. char sz[8] = "August";
  52.  
  53.  
  54. void foo(char *psz);
  55.    
  56. /////////////////////////////////////////////////
  57. int main()
  58. {
  59.    
  60.     //printf("size of double = %d\n", sizeof(f) );
  61.    
  62.     strcpy((char*)(&f), sz);
  63.    
  64.     foo((char*)&f);
  65.    
  66.     printf("f = %f\n", f);
  67. }
  68.  
  69.  
  70.  
  71.  
  72. //////////////////////////////////////////////////
  73. void foo(char *psz)
  74. {
  75.      
  76.      printf("%s\n", psz);
  77.      
  78. }
  79.  
  80.  
  81. */
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. /*
  91.  
  92.  
  93. #include   <stdio.h>
  94.  
  95.  
  96.  
  97. int nA_0[20] = {1, 5, 67, 2},
  98.     nA_1[10] = {3, 5,  7, 2},
  99.     nA_2[ 4] = {2, 5, 27, 2};
  100.    
  101. int *p[3];  
  102.  
  103. int nA[3][8];  
  104.    
  105. /////////////////////////////////////////////////
  106. int main()
  107. {
  108.    
  109.     p[0] = nA_0;
  110.     p[1] = nA_1;   
  111.     p[2] = nA_2;
  112.    
  113.    
  114.     for(int i = 0; i < 3; i++)
  115.     for(int j = 0; j < 4; j++)
  116.     {
  117.            
  118.        printf("%3d, ", p[i][j]);  
  119.        
  120.        if(j == 3) printf("\n");      
  121.     }
  122.        
  123. }
  124.  
  125.  
  126. */
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144. /*
  145.  
  146. #include   <stdio.h>
  147.  
  148.  
  149.  
  150. int nArr[20] = {1, 5, 67, 2};
  151.  
  152. /////////////////////////////////////////////////
  153. int main()
  154. {
  155.    
  156.     for(int i = 0; i < 20; i++)
  157.     {
  158.                
  159.        printf("%d \n", &nArr[i]);  
  160.     }
  161. }
  162.  
  163. */
  164.  
  165.  
  166.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement