The strcat function implements a simple example

  • 2020-04-02 02:15:10
  • OfStack

The code function is to add the SRC reference string to the end of dest (overwriting the '\0' at the end of dest) and add '\0'


char* strcat(char* strDest, const char* strSrc)
{
   char *rem = strDest;
   while(*strDest) strDest++;

   while(*strSrc!='0'){*strDest++=*strSrc++;}

   *strDest='0';
   return rem;
}

Related articles: