I have that simple hello world program.
First row it says #include <stdio.h>
.
I googled it and it tells basically the preprocessor to define the functions for input/output.
First question:
I read that the actually code of the function first compiled to an object file. So if I say #include <foo.bar>
it automatically linkes that object file?
Second question:
When I removed the include, the program still works... I mean the printf
statement... why?
printf()
is located in standard C library and linker links standard library to your program.So any standard functions will not be any linking problems.
If you compile the program without
#include<stdio.h>
usinggcc
you will get the warning.