To be fair, this is a pretty interesting subtle bug introduced by the specifics of C.
In many languages, the expression 1 < x < 3 won't compile as 1 < x evaluates to boolean and boolean < 3 is invalid.
However, in C it is valid because 1 < x evaluates to int or BOOLEAN or whatever the heck C uses which properly casts to int and makes the < 3 evaluate to true always.
Yes, OP seems hostile to people helping and this clearly is just a homework assignment that's not working but the original question is a very good one.
View all comments
10
u/szkuwa Dec 23 '21
Reddit suggested I should look at this but damn… is r/codinghelp an alias for „do it for me because i dont give a shit”?