below given program is working without including <stdio.h>
? Why does this work?
int main()
{
printf("integra");
return 0;
}
Definition of printf() is there in libc.so and the dynamic linker will take care of it even if you don't include the header file. During compile time, printf() will be an undefined symbol and it assumes that it may find the definition later on in libc. The header file will just give the proto-type and suppress the compiler(warnings) stating that the definition of the prototype is present in glibc. So basically, the header files are included just to make sure that the definitions are available in our libraries, to help the developer.
in older standard, undeclared function assume int
argument and return value. Your char*
have same size (32-bit) as int
, so everything work.
Just don't do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With