Advertisement
dllbridge

Untitled

Oct 27th, 2020
1,074
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1.  
  2.  
  3. #include       <stdio.h>
  4. #include      <string.h>
  5.  
  6.  
  7. int n;
  8.  
  9.  
  10. char c;
  11.  
  12.  
  13. int array[123];  // 4 * 123 bytes
  14.  
  15.  
  16.  
  17. char sz[123]  = " Hello, SONY!",
  18.      sz1[123] = {65, 43, 66, 44, 67};
  19.  
  20.  
  21.  
  22.  
  23. int _strlen(const char *psz);
  24.  
  25.  
  26. ////////////////////////////////////////////////////
  27. int main()                                        //
  28. {
  29.    
  30.    
  31.     sz[8] = 85;
  32.    
  33.    
  34.     strcat(sz1, sz);   //  strcpy
  35.    
  36.     printf("string = %s \n", sz1);
  37.    
  38.     int n = _strlen(sz1);
  39.    
  40.    
  41.     printf("sz1 len = %d", n);
  42.    
  43. return 0;
  44. }
  45.  
  46.  
  47.  
  48.  
  49. ////////////////////////////////////////////////////////////
  50. int _strlen(const char *psz)
  51. {
  52.    
  53.      int n = 0;
  54.    
  55.       for(int i = 0; psz[i] != 0; i++)
  56.       {
  57.        
  58.           n ++;
  59.        
  60.       }
  61.      
  62.       n += 100;
  63.    
  64. return n;  
  65. }
  66.  
  67.  
  68.  
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement