Does calling printf without a proper prototype invoke undefined behavior?
问题 Does this innocent looking program invoke undefined behavior: int main(void) { printf("%d\n", 1); return 0; } 回答1: Yes invoking printf() without a proper prototype (from the standard header <stdio.h> or from a properly written declaration) invokes undefined behavior. As documented in C11 Annex J (informative only) J2 Undefined Behavior For call to a function without a function prototype in scope where the function is defined with a function prototype, either the prototype ends with an