#include<stdio.h>
int len(char* sp)
{
int count = 0;
for (int i = 0;; i++)
{
if (*(sp + i) == ' ')
continue;
if (*(sp + i) == '\0')
break;
count++;
}
return count;
}
int main() {
int i;
char ch[100];
for (i = 0;; i++)
{
scanf("%c", &ch[i]);
if (ch[i] == '\n') {
ch[i] = '\0';
break;
}
}
int lea = len(ch);
printf("%d", lea);
return 0;
}
标签:count,ch,int,sp,len,char,字符串,长度 From: https://blog.csdn.net/2401_88256180/article/details/144654795