C 为什么在这个程序中printf的用法是错误的?

C 为什么在这个程序中printf的用法是错误的?,c,function-pointers,C,Function Pointers,我在对的回答中看到了这个示例代码 printf位于stdio.h,而不是stdlib.h 添加stdio.h的包含: #include <stdio.h> #包括 您已包含stdlib.h而不是stdio.h。定义printf的是stdio.h,而不是stdlib.h。因此,如果您更改了,警告可能会得到解决。只是补充一下其他人所说的,如果C编译器遇到一个没有看到原型的函数,它会对该函数的签名做出一个假设,而这个假设通常是错误的 include stdio.h包含函数的原型,这样编译

我在对的回答中看到了这个示例代码


printf
位于
stdio.h
,而不是
stdlib.h

添加stdio.h的包含:

#include <stdio.h>
#包括

您已包含stdlib.h而不是stdio.h。定义printf的是stdio.h,而不是stdlib.h。因此,如果您更改了,警告可能会得到解决。

只是补充一下其他人所说的,如果C编译器遇到一个没有看到原型的函数,它会对该函数的签名做出一个假设,而这个假设通常是错误的


include stdio.h包含函数的原型,这样编译器就不必猜测它的签名。

如果包含
,它能工作吗?
test.c: In function ‘printColor’:
test.c:21: warning: incompatible implicit declaration of built-in function ‘printf’
#include <stdio.h>