Hi.. I'm wondering, is there a correct way of writing header file..?
I look at some of the header files that are written, and tried to modify and compile a few..
An example is i open up C18's original delays.h. The first 2 lines are
Code:
#ifndef __DELAYS_H
#define __DELAYS_H
When I deleted the #define line, it still compile and run. Even if I replace "__DELAYS_H" with anything, it will still compile and run.. What does the 2 line mean and what is the reason of putting it there..?
Yes, for this particular instance. What harm was caused by noting that #endif cannot be ignored, though? As I said, I only mentioned it for completeness.
Also note that the compiler won't stop you from putting very foolish things in the header file, like actual code. That will probably compile and run fine but it defeats the organizational structure the header file was designed to create.