新手读到一段程序困扰
#include <stdio.h>int main ()
{int len;
char*str[20];
printf("please input a string:\n");
scanf("%s",str);
len=length(str);
printf("the string has %d characters.",len);
}
length(p)
char *p;
{int n;
n=0;
while(*p!='\0')
{n++;p++;
}
return n;}
为啥运行length未声明?源代码里是char*str[20];怎么不是char str[20]