我正在使用下面的代码计算字符串中的空格,但我不想计算空格。如何不计算空格,同时计算字符串的长度c
#include<stdio.h>
#include<conio.h>
void main()
{
char*ptr,str[30];
int size=0;
int word=0;
puts("enter the string");
gets(str);
fflush(stdin);
for(ptr=str;*ptr!='\0',ptr++)
{
size++;
}
printf("size of string is = %d",size);
getchar();
}
,这是你写的代码?没有新线,没有空格,什么都没有? –
这个python怎么样? –
'void main'不是标准c。你使用的是非标准的编译器吗? – user2079303