Advertisement
dllbridge

Untitled

Jul 21st, 2024
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.50 KB | None | 0 0
  1.  
  2.  
  3. #include   <stdio.h>
  4.  
  5.  
  6. int foo(int *p);
  7.  
  8.  
  9. ////////////////////////////////////////////////////
  10. int main()                                        //
  11. {
  12.      int nArr[10] = {100, 101, 102, 103};  
  13.      
  14.      
  15.      int n = foo(nArr);
  16.      
  17.      
  18.      printf("Summa = %d\n", n);  
  19. }
  20.  
  21.  
  22. /////////////////////////////////////////////////////
  23. int foo(int *p)                                    //  
  24. {
  25.     int nSumm = 350;    
  26.        
  27.         nSumm = *p;
  28.        
  29.         nSumm = p[1];
  30.        
  31. return nSumm;        
  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. #include   <stdio.h>
  61. #include  <string.h>
  62.  
  63.  
  64.  
  65. FILE *pf;
  66.  
  67.  
  68. char sz[99];
  69.  
  70.  
  71. ////////////////////////////////////////////////////
  72. int main()                                        //
  73. {
  74.  
  75.        
  76.     pf = fopen("hello.txt", "r"    );  
  77.  
  78.     if(pf != 0) printf("File open OK\n");         //                          Error!  
  79.  
  80.     for(int i = 0; i < 2; i++)
  81.     {
  82.         fscanf(pf, "%s", sz);
  83.         printf("%s\n " , sz);
  84.     }
  85.    
  86.     fclose (pf);
  87.        
  88.  
  89. }
  90.  
  91.  
  92. */
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102. /*
  103.  
  104. #include   <stdio.h>
  105. #include  <string.h>
  106.  
  107.  
  108.  
  109.  
  110. FILE *pf;
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117. ////////////////////////////////////////////////////
  118. int main()                                        //
  119. {
  120.  
  121.        
  122.     pf = fopen("PICTURES.c", "w"    ); 
  123.  
  124.     if(pf != 0) printf("File open OK\n");                         //                          Error!  
  125.  
  126.     fprintf(pf, "%s\n",         "psz  PICTURES.c");
  127.     fclose (pf);
  128.        
  129.  
  130. }
  131.  
  132.  
  133. */
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147. /*
  148. #include   <stdio.h>
  149. #include  <string.h>
  150.  
  151.  
  152.  
  153.  
  154. FILE *pf;
  155.  
  156.  
  157. int f_w(const char *psz);
  158.  
  159.  
  160.  
  161. ////////////////////////////////////////////////////
  162. int main()                                        //
  163. {
  164.     //int n = f_w("Kino");
  165.  
  166.        
  167.     pf = fopen("hello.txt", "w"    );  
  168.  
  169.    // if(pf != 0) return 0;                         //                          Error!  
  170.  
  171.     fprintf(pf, "%s\n",         "psz");
  172.     fclose (pf);
  173.        
  174.     //printf("n = %d\n", n);
  175. }
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185. ////////////////////////////////////////////////////
  186. int f_w(const char *psz)                          //
  187. {
  188.        
  189.        
  190.     pf = fopen("hello.txt", "w"    );  
  191.  
  192.     if(pf != 0) return 0;                         //                          Error!  
  193.  
  194.     fprintf(pf, "%s\n",         psz);
  195.     fclose (pf);
  196.    
  197. return 1;                                         //                          Sucess
  198. }
  199.    
  200.  
  201.  
  202.  
  203. */
  204.  
  205.  
  206.  
  207.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement