3 ms·
I would not let that line pass code review. Obviously. However, it is an appropriate example if your goal is to teach the intricacies of the C language. You're
by cygx 10y ago
I would not let that line pass code review.
Obviously. However, it is an appropriate example if your goal is to teach the intricacies of the C language. You're right that if you provide such an example this early, it could perhaps use some additional commentary.
Not only is that confusingly cutesy, but largeA[i] is a double.
That was the point of the exercise: !! is an idiom to convert to boolean (which happen to be integral in C) and something a C programmer (or JavaScript programmer, for that matter) should be familiar with.
This is flatly untrue on x86 and I suspect many other architectures.
Agreed.
- colanderman 10y agoI agree they are great examples to test understanding, but if they're going to be present in the first chapter of a pedagogical book, they need a disclaimer. People copy things.