查找字符串中的空格数
char a[]="i love ios,i want an iphone5s";
int test=0; //记录有多少空格的变量
for(int i=0;i<strlen(a);i++){
if(a[i]==' '){ //判断是否等于空格
test++;
}
}printf("%d\n",test); //输出
posted on 2015-07-24 11:53 yucaijiang 阅读(813) 评论(0) 编辑 收藏 举报