【参考答案】main(){intlen;char *s tr[20];printf("please input a string:n");scanf("%s",str);len=length(str);printf("the s tring has %d characters.",len);getch();}length(p)char p;{int n ;n=0;while(p!=' '){n++;p++;}return n;}

【参考答案】main(){intlen;char *s tr[20];printf("please input a string:n");scanf("%s",str);len=length(str);printf("the s tring has %d characters.",len);getch();}length(p)char p;{int n ;n=0;while(p!=' '){n++;p++;}return n;}