C中的头文件有什么意义? [英] What is the point of header files in C?
问题描述
可能的重复项:
[C]每个源文件的标题.
在C ++中,为什么会有头文件和cpp文件?
C ++-.h文件应该包含什么?
Possible Duplicates:
[C] Header per source file.
In C++ why have header files and cpp files?
C++ - What should go into an .h file?
C中是否存在头文件的唯一原因是开发人员可以快速查看哪些功能可用,以及它们可以采用哪些参数?还是与编译器有关?
Is the only reason header files exist in C is so a developer can quickly see what functions are available, and what arguments they can take? Or is it something to do with the compiler?
为什么没有其他语言使用此方法?仅仅是我,还是拥有2组功能定义只会导致更多的维护和更多的出错空间?还是每个C开发人员都必须了解头文件?
Why has no other language used this method? Is it just me, or does it seem that having 2 sets of function definitions will only lead to more maintenance and more room for errors? Or is knowing about header files just something every C developer must know?
推荐答案
需要头文件来声明可用的函数和变量.您可能根本无法访问定义(= .c文件) ; C支持库中仅二进制代码分发.
Header files are needed to declare functions and variables that are available. You might not have access to the definitions (=the .c files) at all; C supports binary-only distribution of code in libraries.
这篇关于C中的头文件有什么意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!