How do header and source files in C work?

后端 未结 5 879
北海茫月
北海茫月 2020-11-30 18:07

I\'ve perused the possible duplicates, however none of the answers there are sinking in.

tl;dr: How are source and header files related in C? Do

5条回答
  •  一生所求
    2020-11-30 18:42

    Header files are used to separate the interface declarations which correspond to the implementations in the source files. They're abused in other ways, but this is the common case. This isn't for the compiler, it's for the humans writing the code.

    Most compilers don't actually see the two files separately, they are combined by the preprocessor.

提交回复
热议问题