strcpy strcat strlen实现

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了strcpy strcat strlen实现相关的知识,希望对你有一定的参考价值。

char * strcpy (char *strDes, const char *strSrc) 
{
 assert((strDes != NULL) && (strSrc != NULL) );
 char *address = strDes; 
 while((*strDes++ = *strSrc++) != \0); //复制-包括‘\0‘
 return address;
}

 

int strlen(const char* str)
{
  assert(str != NULL);
  int len = 0;
  while((*str++) != \0)
  {
      len++;
  }
  return len;              
}

 

以上是关于strcpy strcat strlen实现的主要内容,如果未能解决你的问题,请参考以下文章