The strcpy function implements simple example sharing

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

Copy a string that starts at the SRC address and has a NULL terminator into the address space that starts with dest


char* strcpy(char *strDest, const char* strSrc)
{
   assert(strSrc!=NULL);
   assert(strDest!=NULL);
   int i;
   char *address = strDest;
   for (i=0;strSrc[i]!='0';i++)
   {
      strDest[i]=strSrc[i];
   }
   strDest[i]='0';
   return address;
}


Related articles: