Big Confusion on an easy Program
I am trying with all my power to make this little program work! I have to make a pogram that copies input to output and replaces each string of a blank or more by a single blank!
It is exercise 1-9 if you have The C Programming Language book, second edition!
This is how far I got of it, but I know it is wrong since the compilers prints 102 infinitely! I will post my wrong noob code hoping that someone capable will give me a hint and tell me what am I doing wrong!Here is the code:
Code:
#include <stdio.h>
main()
{
int blank;
int x;
blank = 0;
x = getchar();
while (x != EOF)
{
if (x == ' ');
printf("%d\n", x);
}
}