this question has answer here:
- why doesn’t putchar require header? 2 answers
why code work:
#include <stdio.h> int main() { int x = isspace(getchar()); printf("%d", x); return 0; } whenever enter whitespace isspace() returns 8 , when don't, gives 0.
shouldn't produce error @ compile time? didn't add #include <ctype.h> @ top. why allowed?
you're seeing because compiler (sadly, still) supports implicit declaration of function.
if enable strict checking, compiler should refuse compile code. on , above c99, implicit function declaration has been made non-standard. (to add, hopefully, future versions of compiler strictly disallow this, default.)
Comments
Post a Comment