What is the difference between a header file and a module?
Are both always necessary?
What is the difference between a header file and a module?
Are both always necessary?
A header file contains declarations only. A module (if you refer to the separately compiled c file) contains the actual data.
The header file tells the other parts of the program what is in the module since they don't know until the linking occurs.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
so are both always necessary?
Modules are the ones that do the work, header files are the ones that give you access to the modules, so you need both.
>> so are both always necessary?
You use the word always so I'm going to assume you mean always. The answer is this, you only need a header when you use a function that is in the actual module. Even if you compile a library (or whatever form of module you are refering to) or something into your program!