Advertisement
dllbridge

Untitled

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