program that counts blanks, tabs, and newlines
c, newline, tabs
Solution
blanks = spaces (`' '`)
Though your code is working I strongly suggest adding `{ }` for the body of the while loop.
Problem
I'm reading The C Programming Language. Here is a question which is saying Write a program to count blanks, tabs, and newlines. Now I can use \n for newlines and \t for tabs, but I am hearing first time about blanks! What it really mean by blanks? For the newlines and tabs, I have compiled following program: ``` #include <stdio.h> /* program to count blanks, tabs, and newlines */ main (){ long blanks, tabs, newlines, input; blanks = 0; tabs = 0; newlines = 0; input = 0; while ((input = getchar()) != EOF) if (input == '\n') ++newlines; else if (input == '\t') ++tabs; printf("Total newlines: %ld\nTotal Tabs: %ld", newlines, tabs); } ```