不知道最后哪错了,求助!!!!!!!
/*求字符串长度*/#include<stdio.h>
int main ()
{
int length(char * p);
int len;
char str[20];
printf("please input string:");
scanf_s("%s",str);
len=length(str);
printf("%d",len);
return 0;
}
int length(char *p)
{
int n;
n=0;
while(*p != '\0')
{
n++;
p++;
}
return(n);
}
please input string:china
0 //怎么结果是0????
请按任意键继续. . .