I'm in the process of reading through K&R, and I'm kind of stumped on this one exercise which they suggest; namely, rewriting the following loop so it does not utilize && or ||:
for (i=0; i<lim-1 && (c=getchar()) != '\n' && c != EOF; ++i)
s[i] = c;
I'm really not sure how one would approach this problem, without creating some horrid hack involving multiple nested loops or something like that(the wording seems to stipulate that you only use one one loop, but I could be misinterpreting).
Can someone suggest me a solution(you don't need to write out full code, just a basic explanation of the logic behind the solution should suffice)?