Problem 8-5 using the copy function realized string portion

. 1  void strmcpy ( char * t, int m, char * S)
 2  {
 . 3      int len = 0 ; // calculate the length of the string t 
. 4      char * P = t;
 . 5      int I;
 . 6      the while ! (* = P ' \ 0 ' )
 . 7      {
 . 8          len ++ ;
 . 9          P ++ ;
 10      }
 . 11  
12 is      IF (m <= len)
 13 is      {
 14         for (i = 0; t[m - 1 + i] != '\0'; i++)
15         {
16             s[i] = t[m - 1 + i];
17         }
18         s[i] = '\0';
19     }
20     else
21     {
22         *s = '\0';
23     }
24 }

Guess you like

Origin www.cnblogs.com/2018jason/p/12072393.html