C语言问题strlen(a)返回的字符串长度包括‘\0’这位吗

来源:百度知道 编辑:UC知道 时间:2024/05/22 06:56:09

不包括,要不就没有空字符串了

不包括

不包括
例如:
// crt_strlen.c

#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>

int main( void )
{
char buffer[61] = "How long am I?";
int len;
len = strlen( buffer );
printf( "'%s' is %d characters long\n", buffer, len );
}

output:
'How long am I?' is 14 characters long