K&R Exercise 1-9: output the input, replacing multiple blanks by a single blank
In the for-loop statement, you’re having the bug. for(ch = getchar(); (ch = getchar()) != EOF; lch = ch){…} Here, you’re storing first character in ch, and then again testing if (ch!=EOF) by again reading character input. Remove ch=getchar() from the initialisation statement; let it be in the second part. for(;(ch = getchar()) != EOF; … Read more