Advertisement
dllbridge

Untitled

Dec 13th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.79 KB | None | 0 0
  1.  
  2. #include <stdlib.h>
  3. #include   <time.h>
  4.  
  5.  
  6. int foo(int *p);
  7.  
  8. ////////////////////////////////////////////
  9. int main()
  10. {
  11.  
  12.  
  13.  
  14. }
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23. /*
  24. #include <stdlib.h>
  25. #include   <time.h>
  26.  
  27.  
  28. int foo(int *p);
  29.  
  30. ////////////////////////////////////////////
  31. int main()
  32. {
  33.  
  34.     srand(time(0));  //   printf("NULL = %d\n", NULL);
  35.  
  36.     printf("UNIX Time = %d\n", time(0) );
  37.      
  38.     for(int i = 0; i < 20; i++)
  39.     {
  40.            
  41.         printf("%d\n", rand());        
  42.            
  43.     }
  44. }
  45.  
  46. */
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. /*
  64. #include  <stdio.h>
  65. #include <stdlib.h>
  66. #include   <time.h>
  67.  
  68.  
  69. int foo(int *p);
  70.  
  71. ////////////////////////////////////////////
  72. int main()
  73. {
  74.  
  75.   srand(time(0));  //   printf("NULL = %d\n", NULL);
  76.  
  77.   int arr[10] = {0, 12, 2, 3, 4, 5, 6, 7, 8, 9};
  78.  
  79.   int *p = arr;
  80.  
  81.   p = p + 9;
  82.  
  83.  // arr = arr + 9;
  84.  
  85.   int n1 =  foo(p);// foo(&arr[9]);
  86.  
  87.   printf(" arr = %d\n",  arr);
  88.  
  89. return 0;
  90. }
  91.  
  92.  
  93. ////////////////////////////////////////////////////////
  94. int foo(int *a)
  95. {
  96.  
  97.      printf("*a   = %d\n", *a  );
  98.      printf(" a   = %d\n",  a  );
  99.    //  a = a - 8;    
  100.    //  printf(" a-8 = %d\n", *a  );      
  101.  
  102.   return a[-8];
  103. }
  104. */
  105. /*
  106.  
  107. #include  <stdio.h>
  108. #include <stdlib.h>
  109. #include   <time.h>
  110.  
  111.  
  112. int foo(int *p);
  113.  
  114. ////////////////////////////////////////////
  115. int main()
  116. {
  117.  
  118.   srand(time(0));  //   printf("NULL = %d\n", NULL);
  119.  
  120.   int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  121.  
  122.   int n1 = foo(&arr[9]);
  123.  
  124.   printf(" n1 = %d\n",  n1);
  125.  
  126. return 0;
  127. }
  128.  
  129.  
  130. ////////////////////////////////////////////////////////
  131. int foo(int *a)
  132. {
  133.  
  134.      printf("*a   = %d\n", *a  );
  135.      printf(" a   = %d\n",  a  );
  136.      a = a - 8;    
  137.      printf(" a-8 = %d\n", *a  );      
  138.   // printf("%d", arr[1]);
  139.   return a[0];
  140. }
  141. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement