Advertisement
dllbridge

Untitled

Nov 1st, 2023
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.16 KB | None | 0 0
  1.  
  2. #include   <stdio.h>
  3.  
  4.  
  5. void foo();
  6.  
  7.  
  8. /////////////////////////////////////////////////////
  9. int main()                                         //
  10. {
  11.    
  12.     foo();
  13.     foo();
  14. }
  15.  
  16.  
  17. ///////////////////////////////////////////////////
  18. void foo()                                       //
  19. {
  20.    
  21.    static int n = 1;
  22.    
  23.    printf("%d\n", n);
  24.    
  25.    n += 5;                           //n = n + 5;  
  26.    
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. /*
  61.  
  62. #include   <stdio.h>
  63.  
  64.  
  65. int n = 77;
  66.  
  67.  
  68. /////////////////////////////////////////////////////
  69. int main()                                         //
  70. {
  71.    
  72.  
  73.         if(n ==   15) printf(  "15");
  74.         else
  75.         {  
  76.            if(n ==  104) printf( "104");
  77.            else
  78.            {               
  79.               if(n == 1025) printf("1025" );
  80.               else          printf("Error");       
  81.            }
  82.         }          
  83.                  
  84. }
  85.  
  86.  
  87.  
  88. */
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. /*
  112. #include   <stdio.h>
  113.  
  114.  
  115. int n = 104;
  116.  
  117.  
  118. /////////////////////////////////////////////////////
  119. int main()                                         //
  120. {
  121.    
  122.  
  123.         if(n ==   15) printf(  "15");  
  124.         if(n ==  104) printf( "104");          
  125.         if(n == 1025) printf("1025");          
  126.                    
  127.                  
  128.       //  printf("Error");                 
  129.  
  130.    
  131. }
  132.  
  133.  
  134.  
  135. */
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149. /*
  150.  
  151. #include   <stdio.h>
  152.  
  153.  
  154. int n = 104;
  155.  
  156.  
  157. /////////////////////////////////////////////////////
  158. int main()                                         //
  159. {
  160.    
  161.     switch(n)
  162.     {
  163.        
  164.        case   15: printf(  "15");          
  165.                   break;   
  166.        
  167.        case  104: printf( "104");          
  168.                 //break;
  169.                
  170.        case 1025: printf("1025");          
  171.                 //  break;     
  172.                  
  173.        default:   printf("Error");                 
  174.     }
  175.    
  176. }
  177.  
  178. */
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200. /*
  201. #include   <stdio.h>
  202. //#include  <string.h>
  203.  
  204.  
  205. void _strcpy(char *, const char *);  
  206.  
  207.  
  208. /////////////////////////////////////////////////////
  209. int main()                                         //
  210. {
  211.    
  212.     char sz[20] = "fresh",
  213.         sz1[20] = "tomato_SONY";
  214.  
  215.     printf("%s\n", sz);
  216.  
  217.    _strcpy(&sz[0], "sz1");  
  218.    
  219.  
  220.     printf("%s\n", sz);
  221. }
  222.  
  223.  
  224.  
  225. //////////////////////////////////////////////////////
  226. void _strcpy(char *psz1, const char *psz2)                //
  227. {
  228.    
  229.    
  230.     int i = 0;
  231.    
  232.     for(; psz2[i] != 0; i++)
  233.     {
  234.         psz1[i] = psz2[i];
  235.     }
  236.     psz1[i] = 0;   
  237. }
  238.  
  239.  
  240. */
  241.  
  242.  
  243.  
  244. /*
  245. #include   <stdio.h>
  246. //#include  <string.h>
  247.  
  248.  
  249. void _strcpy(char *, char *);  
  250.  
  251.  
  252. /////////////////////////////////////////////////////
  253. int main()                                         //
  254. {
  255.    
  256.     char sz[20] = "fresh",
  257.         sz1[20] = "tomato_SONY";
  258.  
  259.     printf("%s\n", sz);
  260.  
  261.    _strcpy(&sz[0], sz1);  
  262.    
  263.  
  264.     printf("%s\n", sz);
  265. }
  266.  
  267.  
  268.  
  269. //////////////////////////////////////////////////////
  270. void _strcpy(char *psz1, char *psz2)                //
  271. {
  272.    
  273.    
  274.     int i = 0;
  275.    
  276.     for(; psz2[i] != 0; i++)
  277.     {
  278.         psz1[i] = psz2[i];
  279.     }
  280.     psz1[i] = 0;   
  281. }
  282.  
  283. */
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291. /*
  292. #include   <stdio.h>
  293. #include  <string.h>
  294.  
  295.  
  296.  
  297. /////////////////////////////////////////////////////
  298. int main()                                         //
  299. {
  300.    
  301.     char sz[20] = "fresh",
  302.         sz1[20] = "tomato_SONY";
  303.  
  304.     printf("%s\n", sz);
  305.    
  306.     int i = 0;
  307.    
  308.     for(; sz1[i] != 0; i++) sz[i] = sz1[i];
  309.  
  310.     sz[i] = 0;
  311.    
  312.  
  313.     printf(    "%s\n", sz);
  314. }
  315.  
  316.  
  317.  
  318. */
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  //   printf("i = %d\n",  i);
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355. /*
  356.  
  357. #include   <stdio.h>
  358. #include  <string.h>
  359.  
  360.  
  361.  
  362. /////////////////////////////////////////////////////
  363. int main()                                         //
  364. {
  365.    
  366.     char sz[20] = "fresh",
  367.         sz1[20] = "tomato_SONY";
  368.  
  369.     printf("%s\n", sz);
  370.    
  371.     for(int i = 0; i < 996; i++)
  372.     {
  373.        
  374.         sz[i] = sz1[i];
  375.        
  376.         if(sz1[i] == 0) break;
  377.     }  
  378.    
  379.  
  380.     printf("%s\n", sz);
  381. }
  382.  
  383.  
  384.  
  385.  
  386. */
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. /*
  401.  
  402. #define _CRT_SECURE_NO_WARNINGS
  403.  
  404.  
  405. #include   <stdio.h>
  406. #include  <string.h>
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413. /////////////////////////////////////////////////////
  414. int main()                                         //
  415. {
  416.    
  417.     char sz[20] = "fresh",
  418.         sz1[20] = "tomato";
  419.  
  420.     printf("%s\n", sz);
  421.    
  422.     for(int i = 0; i <= 6; i++)
  423.     {
  424.        
  425.         sz[i] = sz1[i];
  426.     }  
  427.    
  428.  
  429.     printf("%s\n", sz);
  430. }
  431.  
  432.  
  433.  
  434. */
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement