[求助]关于替换空格的问题。。。。
这是问题:Write a program to copy its input to its output, replacing each string of one or
more blanks by a single blank.#include <stdio.h>;
int main(void)
{
int c;
int inspace; /*想知道加这个是干什么用的?*/
inspace = 0;
while((c = getchar()) != EOF)
{
if(c == ' ')
{
if(inspace == 0) /*inspace和空格的关系*/
{
inspace = 1;
putchar(c);
}
}
if(c != ' ')
{
inspace = 0;
putchar(c);
}
}
return 0;
}