重写strlen函数(不使用标准库函数)

2014-11-24 01:43:22 · 作者: · 浏览: 16

int strlen( const char *str ) //输入参数const
{
 assert( strt != NULL ); //断言字符串地址非0
 int len;
 while( (*str++) != ‘\0′ )
 {
  len++;
 }
 return len;
}