3 ms·
Given the explanatory text - I think this was more of a "test of intuition" accompanied by a "gotcha!" As someone unfamiliar with C - I initially thought it wo
by Nadya 10y ago
Given the explanatory text - I think this was more of a "test of intuition" accompanied by a "gotcha!"
As someone unfamiliar with C - I initially thought it would go on forever. The explanatory text explained why I was wrong and this can be equally parts "clever code" or a "gotcha!" depending how you view it. With your experience you're seeing it as overly clever code. With mine, I'm seeing it as a "gotcha". I don't think it is supporting writing code like that. :)
>The third for appears like it would go on forever, but actually counts down from 9 to
0. In fact, in the next section we will see that “sizes” in C, that is numbers that have type
size_t, are never negative.