1.

How To Restrict A Header File From Including More Than Once?

Answer»

In C, to avoid double INCLUSION, we use a include guard also known as macro guard. It is #ifndef - #ENDIF pair. "ifndef" is an indication of “if not DEFINED”.
#ifndef FAMILY_H
#DEFINE FAMILY_H
struct Example
{
int member;
};
#endif /* FAMILY _H */

In C, to avoid double inclusion, we use a include guard also known as macro guard. It is #ifndef - #endif pair. "ifndef" is an indication of “if not defined”.
#ifndef FAMILY_H
#define FAMILY_H
struct Example
{
int member;
};
#endif /* FAMILY _H */



Discussion

No Comment Found