// read stdin one char at-a-time while ((ch = getchar()) != EOF) { // do something with ch }
which reads a char into ch and tests it against EOF
ch
EOF
What would the following code do?
// read stdin one char at-a-time while ( ch = getchar() != EOF) { // do something with ch }
Hint: Check precedence table in the C Reference Card or by typing the command
man 7 operator