looking for help on looping

Hi, i was looking for a sample code for reading in a word by looping scanf and so on, and be able to print it out again. i'm actually trying to write a program to count words, syllabals and lines in text, but i'm just starting slow. thx.

The reason you should use an int here is because you're testing for EOF. If you weren't, the assignment would be perfectly fine. However, EOF isn't a value that will fit in a char, so if it occurs and you're assigning it to a char, it will be changed to a different value so that it can fit. This in effect breaks your code, preventing it to work properly.

If however, you don't need to check for EOF, the assignment would be fine. However, since you are in fact testing it for EOF, the assignment is incorrect. Just to clarify the reason it's wrong in this case.