EazyChange

导航

 
char *strcpy(char *strDest, const char *strSrc);
{
  assert((strDest!=NULL) && (strSrc !=NULL)); // 2分
  char *address = strDest; // 2分
  while( (*strDest++ = * strSrc++) != ‘ \0’) // 2分
    NULL ;
  return address ; // 2分
}

strcpy 能把 strSrc 的内容复制到 strDest,为什么还要 char * 类型的返回值?
答:为了实现链式表达式。 // 2 分
例如 int length = strlen( strcpy( strDest, “ hello world”) );

posted on 2016-06-09 14:38  EazyChange  阅读(136)  评论(0编辑  收藏  举报