hmm...I've read this over and over about 15 times now, and I can't figure it out either (keep in mind, C is a mystery to me - I stick to LISP).
I'm thinking perhaps it's a way of forcing the user to input a character that's NOT an EOF or newline; but other blank characters like, tabs, spaces, etc., are legal. hmm.....
*shrug* I suppose this could be so that the s[] array isn't containing more than one of the same value (so there won't be any more than one '\n').
at least that's a possible explanation for what's happening in the FOR loop.
when that IF conditional comes in, that's where it seems to lose all rationality. literally, it's going (starting at the FOR loop):
"loop while c is not an EOF char, or a newline char, and should c be a newline char, exit this loop, and don't assign it to the current array element.
if c is a newline char, assign it to the current array element."
alright...I just re-read it and read that it's a "getline" example.
this makes sense now.
pretty much, the loop will go as long as a non-newline or EOF char is input, and assign each char to an array element. the FOR loop exits when a newline or EOF char is passed. it will kick out of the loop so no error or glitch arises, and if the char passed is a newline, the IF condition makes sure that it's that last character in that char array.
I hope this answers it for you.