c - What is the relationship between #include <stdio.h> and printf()? -
#include <stdio.h> main() printf(); what connection between preprocessor , function?
when c preprocessor reads line #include <stdio.h>, literally reads file stdio.h system directory , replaces line contents. stdio.h contains declarations of printf , other functions, tells c compiler these functions exist in file or library.
when use printf() in code, compiler knows function , knows doesn't have worry it. (if didn't include stdio.h, however, compiler wouldn't have known function looked @ all, have been troublesome , compiler complain this.)
an example stdio.h file printf this:
/* stdio.h */ // declaration of printf int printf(const char *format, ...); // , bunch of other function declarations...
Comments
Post a Comment