忽略在C文件中的文件stdio.h中 [英] Ignoring the stdio.h file in a c file
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/336814/why-include-stdio-h-is-not-required-to-use-printf\">Why #包括LT&;&stdio.h中GT;是*不*需要用printf()?
我面临的一个问题在下面给出code。
I am facing a problem in the below given code.
int main()
{
printf("\nHello Stack Overflow\n\n") ;
return 0 ;
}
在上面提到的code我离开其中的#include。
如果我编译和执行这一块code,正如预期的输出打印。但的#include是在C程序中最重要的事情,我都忽视了它,还是在编译没有任何错误,但有警告完成。
In the above mentioned code i left including "#include ". And if i compile and execute this piece of code, the output is printed as expected. But "#include " being the most important thing in a C program, i have ignored it and still the compilation is done without any errors but with warning.
为什么会出现这种情况?
Why is this happening?
推荐答案
在C,未声明的隐含考虑到返回 INT
,并采取<$函数C $ C> INT 参数。
In C, functions that are not declared are implicitly considered to return an int
and to take int
arguments.
这是坏习惯的,并会咬你。例如,如果你要打印的数据不是int的大小相同,如双击
或浮动
。
This is bad practice and will bite you. For example if you want to print data not the same size of an int, like double
or float
.
这篇关于忽略在C文件中的文件stdio.h中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!