Is this another one of those pointless "can you tie your shoelaces with one hand" type of assignments?
Printable View
Is this another one of those pointless "can you tie your shoelaces with one hand" type of assignments?
Yes, that's my understanding.
As I said earlier, it's fair to say "don't use functions that do the job for you, when you are learning the basics", but certainly "correct code that solves the problem in the way that the teacher expects" should not be rejected just because it uses some "we haven't got there in the book yet". Fair enough that you can't do strcpy() when learning about strings and your task is to copy a string - but to check if the result of getchar() is not EOF in a loop is valid, and not a "trick" to solve the problem easier - it's just more correct.
--
Mats
I really don't think the teacher forbids the use of EOF, since it is the only way of finding the end-of-file and/or an error. There is no other way around. The "tricks" and "cheatings" use EOF, they just don't type it...