Advertisement
dllbridge

Untitled

Jun 18th, 2024
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.41 KB | None | 0 0
  1.  
  2. #include   <stdio.h>
  3.  
  4.  
  5. char sz[99] = "SONY_Pictures",
  6.  
  7.     *psz = &sz[2];
  8.  
  9.  
  10. /////////////////////////////////
  11. int main()                     //
  12. {
  13.    
  14.     printf("  sz = %d\n",   sz);
  15.     printf("*psz = %d\n", *psz);   
  16. }
  17.  
  18.  
  19.  
  20.  
  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  <string.h>
  46.  
  47. char sz1[99] = "SONY_Pictures",
  48.      sz2[99];
  49.      
  50.      
  51. int _strlen(char *);    
  52.  
  53. /////////////////////////////////
  54. int main()                     //
  55. {
  56.    
  57.     strcpy(sz2, sz1);
  58.    
  59.     printf("sz2 = %s\n", sz2);
  60.    
  61.     int n = _strlen(sz1);
  62.    
  63.     printf("n   = %d\n", n);
  64. }
  65.  
  66.  
  67. ///////////////////////////////////////
  68. int _strlen(char *psz)
  69. {
  70.     int n = 0;
  71.    
  72.     for(int i = 0; i < 10000; i++)
  73.     {
  74.         if(psz[i] != 0) n = n + 1;
  75.         else break;
  76.     }
  77. return n;  
  78. }
  79.  
  80.  
  81.  
  82. ///////////////////////////////////////
  83. void _strcpy(char *psz1, char *psz2)
  84. {
  85.    
  86.    
  87. }
  88.  
  89.  
  90. */
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. /*
  104.  
  105. #include  <stdio.h>
  106.  
  107.  
  108. char c = 49;
  109.  
  110. /////////////////////////////////
  111. int main()                     //
  112. {
  113.    
  114.     printf("c = %c\n", c);
  115. }
  116.  
  117. */
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140. /*
  141. #include  <stdio.h>
  142. #include <stdlib.h>
  143. #include   <time.h>
  144.  
  145. /////////////////////////////////
  146. int main()                     //
  147. {
  148.     srand(time(0));
  149.    
  150.     for(int i = 0; i < 10; i ++)
  151.     {
  152.       printf("%d\n", rand() );  
  153.     }
  154. }
  155.  
  156.  
  157. */
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167. /*
  168.  
  169.  
  170. #include <stdlib.h>
  171. #include   <time.h>
  172. #include  <stdio.h>
  173.  
  174.  
  175. /////////////////////////////////
  176. int main()                     //
  177. {
  178.    
  179.     srand(time(0));
  180.  
  181.     int array[20],
  182.                nx,
  183.                ng;
  184.  
  185.  
  186.     for(int i = 0; i < 20; i++)
  187.     {
  188.        
  189.        array[i] = rand();  
  190.     }
  191.    
  192.     ng = array[0];
  193.    
  194.     for(int i = 0; i < sizeof(array)/4; i++ )
  195.     {
  196.        
  197.       if  (array[i] > nx)  nx = array[i];        
  198.     }
  199.     printf("min array: %d\n", ng);
  200.     printf("max array: %d\n", nx);
  201.    
  202.    
  203. return 0;
  204. }
  205.  
  206.  
  207. */
  208.  
  209.  
  210.  
  211. /*
  212. #include <stdio.h>
  213.  
  214.  
  215. /////////////////////////////////
  216. int main()                     //
  217. {
  218.  
  219.     int array[20] = {  1,  12,  43,  54,   4,  12,  3,   5,   8,  55,
  220.                        8, 431, 667,  12,  87,  45,  2, 345,  99,  16},
  221.                nx,
  222.                ng = array[0];
  223.  
  224.    
  225.     for(int i = 0; i < sizeof(array)/4; i++ )
  226.     {
  227.        
  228.       if  (array[i] > nx)  nx = array[i];        
  229.     }
  230.     printf("min array: %d\n", ng);
  231.     printf("max array: %d\n", nx);
  232.    
  233.    
  234. return 0;
  235. }
  236.  
  237.  
  238.  
  239. */
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement