计算字符串长度

来源:互联网 发布:ata模拟考试软件 编辑:程序博客网 时间:2024/05/20 18:41
/*
** Compute the length of a string.
*/


#include 
<stdlib.h>
#include 
<assert.h>
size_t
strlen( 
char *string )
{
 assert(
string != null);
 
 
int length = 0;

 
/*
 ** Advance through the string, counting characters
 ** until the terminating NUL byte is reached.
 
*/

 
while*string++ != '
 
原创粉丝点击