+ 1

Someone explain it... Plz!!!

I'm a bit confused about something in C. I noticed that if I forget to #include <stdio.h>, my code with printf still compiles and runs. I just get a warning. How does that actually work? I thought it always needed the header file. Why isn't it a hard error, and how does the program figure out where the real printf function is? https://sololearn.com/compiler-playground/cr6kUJGXqt8x/?ref=app

23rd Oct 2025, 1:07 PM
Ferdous 👾
Ferdous 👾 - avatar
1 ответ
+ 1
Ferdous 👾 I believe the compiler is running in C89/C90 compatibility mode by default and the compiler is part of the GNU Compiler Collection (GCC), which historically allowed this as a warning for common cases like printf even in newer modes, though it's discouraged.
23rd Oct 2025, 1:17 PM
BroFar
BroFar - avatar