2 ms·
1) In TFA, s/cersion/version/, but that's an amusing typo. :-) 2) Initializing inside the for loop requires C99; is that to be considered idiomatic? I didn't t
by js2 16y ago
1) In TFA, s/cersion/version/, but that's an amusing typo. :-)
2) Initializing inside the for loop requires C99; is that to be considered idiomatic? I didn't think so. I'll be curious how many submissions were either identical to your suggested idiomatic solution or its K&R equiv:
https://gist.github.com/3f4daf24595788258a01 https://gist.github.com/3f4daf24595788258a01
:-)
- RiderOfGiraffes 16y ago1) In TFA, s/cersion/version/, but that's an amusing typo. :-) Bother - now fixed. Thanks.
- JoachimSchipper 16y agoAlthough I'm not sure "its K&R equivalent" is correct (that's C89 and has "modern" function implementations), C99 is indeed not that common. If only because many compilers don't support it (including Microsoft's).
- js2 16y agoBah, I learned my C from K&R 2nd ed. I guess that's not K&R C, is it? :-)
- JoachimSchipper 16y agoIt's... complicated. K&R 2nd ed. (which is an excellent book!) is based on a draft of ANSI C; pre-ANSI C was not standardized but rather based on an informal reading of K&R 1st ed., hence "K&R syntax" and the like. At least, if I recall correctly.