Why do we need header files?

The #include directive in C is used to insert the contents of one file into another before the program is compiled, often used for adding header files with function and variable declarations.

C/C++ compilers need to know the definition of a function etc. before you can use it in the code since C/C++ are strongly typed languages. In dynamic language you don’t need this.

It’s important that we pre-declare our types.

Â