ven*_*kat 5 c implicit-declaration
下面给出的程序工作不包括<stdio.h>?为什么这样做?
int main()
{
printf("integra");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
printf()的定义存在于libc.so中,即使您不包含头文件,动态链接器也会处理它.在编译期间,printf()将是一个未定义的符号,它假定它可能稍后在libc中找到定义.头文件将只提供proto-type并禁止编译器(警告)声明原型的定义存在于glibc中.所以基本上,包含头文件只是为了确保我们的库中有定义,以帮助开发人员.