What's the difference between using extern and #including header files?

前端 未结 2 641
心在旅途
心在旅途 2021-02-01 18:00

I am beginning to question the usefulness of \"extern\" keyword which is used to access variables/functions in other modules(in other files). Aren\'t we doing the same thing whe

2条回答
  •  伪装坚强ぢ
    2021-02-01 18:32

    No. The #include is a preprocessor command that says "put all of the text from this other file right here". So, all of the functions and variables in the included file are defined in the current file.

提交回复
热议问题