I’m writing C++ in the title of this article because I’m currently in a journey to learn C++. I believe the same concepts apply to C.
Writing about C++ is a little harder than writing about other languages because I keep stumbling into circular references where I need to understand A in order to understand B, but it’s very hard to understand A without understanding B.
I’m going to try to start with this article where I’ll explain why C++ has header files (files with .h extension) and how to use them.
Before we start looking into header files, lets first look at how code is split and included in languages where there are no header files. This little example is in node.js: