如题所述
strlen返回的是存储的字符byte个数
对于“verygood”是八个字符,所以strlen返回 8
#include <stdio.h>#include <string.h>int main (){ char a[256] = "verygood"; printf ("\"%s\" is %zu characters long.\n", a, strlen(a)); return 0;}
#include <stdio.h>
#include <string.h>
int main ()
{
char a[256] = "verygood";
printf ("\"%s\" is %zu characters long.\n", a, strlen(a));
return 0;
}