Advertisement
dllbridge

Untitled

Sep 24th, 2023
916
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1.  
  2.  
  3. #include    <stdio.h>
  4. #include   <string.h>
  5.  
  6. int _strlen(char *);
  7. int _strcpy(char *psz, const char *);
  8. // int _strcat(char *psz, const char *);
  9.  
  10. char sz [100] = "S_ONY",
  11.      sz2[100] = "_Pictures";
  12.  
  13.    
  14. ////////////////////////////////////////////////////////
  15. int main()                                            //
  16. {
  17.    
  18.    _strcpy(sz, "Sobolev Dima");
  19.    
  20.    
  21.     printf("sz = %s\n", sz);   
  22.    
  23. }
  24.  
  25.  
  26.  
  27. //////////////////////////////////////////////////////// 0 = FALS
  28. int _strcpy(char *psz, const char *psz2)              // 1 = TRUE
  29. {
  30.    
  31.     int nLen = 0;
  32.    
  33.    
  34.     while(psz2[nLen])
  35.     {
  36.        
  37.         nLen += 1;
  38.     }  
  39.    
  40.    
  41.     for(int i = 0; i < nLen; i++)
  42.     {
  43.        
  44.         psz[i] = psz2[i];  
  45.     }
  46.    
  47.     psz[nLen] = 0;
  48. }
  49.  
  50.  
  51.  
  52. //////////////////////////////////////////////////////// 0 = FALS
  53. int _strlen(char *psz)                                 // 1 = TRUE
  54. {
  55.    
  56.     int nLen = 0;
  57.    
  58.    
  59.     while(psz[nLen])
  60.     {
  61.        
  62.         nLen += 1;
  63.     }
  64.    
  65.    
  66. return nLen;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement