J
johnnash
ok so i was just reading about #ifndef and header files. I have a few
doubts. It would be great help if someone can clear my doubts..
#ifndef A_H
#define A_H
....
code
.....
#endif
^^ lets say A.h is included in B.h which is included in C.h..so how
will the compiler resolve everything ??
also i saw some programs where there are many files like a.h, a.c,
b.h, b.c, c.h, c.c etc and then there is a all.h file
which goes like this -
#ifndef A_H
#include "a.h"
#endif
#ifndef B_H
#include "b.h"
#endif
#ifndef C_H
#include "c.h"
#endif
then only all.h is included in a.c, b.c and c.c
how did it work ??
doubts. It would be great help if someone can clear my doubts..
#ifndef A_H
#define A_H
....
code
.....
#endif
^^ lets say A.h is included in B.h which is included in C.h..so how
will the compiler resolve everything ??
also i saw some programs where there are many files like a.h, a.c,
b.h, b.c, c.h, c.c etc and then there is a all.h file
which goes like this -
#ifndef A_H
#include "a.h"
#endif
#ifndef B_H
#include "b.h"
#endif
#ifndef C_H
#include "c.h"
#endif
then only all.h is included in a.c, b.c and c.c
how did it work ??