I just took a C aptitude test on http://upwork.com.
One question flummoxed me as the code contained a printf
without a corresponding #include stdio.h
. Essentially:
int main(){
/* !!! some complicated logic... */
printf("%d", blah);
}
And the multiple choice contained the option of a compiler error.
So I wasn't sure if it was a trick question. But gcc compiles int main(){ printf("foo"); }
happily on OSX.
Is this guaranteed by the standard?