C/C++ header and implementation files: How do they work?

前端 未结 7 2053
执笔经年
执笔经年 2020-11-30 22:43

This is probably a stupid question, but I\'ve searched for quite a while now here and on the web and couldn\'t come up with a clear answer (did my due diligence goo

7条回答
  •  北海茫月
    2020-11-30 23:43

    int myfunction(int); is the function prototype. You declare function with it so that compiler knows that you are calling this function when you write myfunction(0);.

    And how do the header and main function even know the function definition exists?
    Well, this is the job of Linker.

提交回复
热议问题