请写出程序的运行结果。 #include
length(char *p) {
int n ; n=0 ;
while(*p!='\0') {
if (! (*p>='0' && *p<='9')) n++ ; p++ ;
}
return n ;
}
int main() {
char str1[20],str2[20] ; scanf("%s",str1) ;
scanf("%s",str2) ;
printf("the string has %d characters.\n",length(str1)) ; printf("the string has %d characters.\n",length(str2)) ; return 0 ;
}
①当输入 “hello world ” 时,程序的运行结果。
②当输入 “hello student123 ” 时,程序的运行结果。
查看答案和解析【26考研辅导课程推荐】:26考研集训课程,VIP领学计划,26考研VIP全科定制套餐(公共课VIP+专业课1对1) , 这些课程中都会配有内部讲义以及辅导书和资料,同时会有教研教辅双师模式对大家进行教学以及督学,并配有24小时答疑和模拟测试等,可直接咨询在线客服老师领取大额优惠券。
启航教育热门私房课
MORE小班面授 名额有限 抢先体验
编辑推荐
最新内容