Almost everyone who has even written a hello world program in C/C++ must have used header files using the include directive (remember how you imported stdio.h or iostream.h or used custom header files). But why do we actually need header files? Obviously to use predefined libraries whenever we want and don’t have to write all the crap everytime we start using it. Hmm yes, that’s true, but do we really need a specific file for that, why can’t we simply import the .cpp/.c file wherever it is required, I mean that would entirely bring the body of the function in our source code, thus we can simply use it. The answer to this question might seem extremely obvious to some of us but let us try to explore the seriousness of it step by step.
Anyone who has written even a simple makefile would know but for the sake of completion, compilation process consists of multiple steps:
- Preprocessor: First the preprocessor preprocesses all the code before compilatio