可以,不过要包含string.h #include "string.h"include "stdio.h"include "string.h"void func(){ char p[]="abc";printf("%d",strlen(p));} void main{ func();}
strlen只可以用来测量char*字符串的长度,求数组长度(比如int a[])要用sizeof(a)/sizeof(int)