this is my 3rd day into C, i just noticed that my program I/O works without #include <stdio.h>. So i am wondering does same apply for all other directives?
#include <stdio.h>
this is my 3rd day into C, i just noticed that my program I/O works without #include <stdio.h>. So i am wondering does same apply for all other directives?
#include <stdio.h>
In modern C, you should always declare any function, whether yours or a standard library function, before calling it. Some compilers may provide a default declaration for an undeclared function, but this is an archaic behavior and should be avoided. So, even if your program works without including <stdio.h>
, it will not be portable to C implementations that do not provide this old behavior and is not good practice.
Including standard headers is an easy, clear, and safe way to declare standard library functions. The C standard allows a program to declare standard library functions itself, as long as its declarations are suitable matches to the functions. However, this practice should be done only in special situations where including all of a standard header is undesired.