any idea of there is a way to check to see if a file has already been included.
I have two C files that both share a header file and it seems silly to #include <studio.h> in both.
Any ideas?
Printable View
any idea of there is a way to check to see if a file has already been included.
I have two C files that both share a header file and it seems silly to #include <studio.h> in both.
Any ideas?
you can just put the #include <stdio.h> in the header file that they both share.
You may have noticed that all (properly-written!) header files have something like:
This works, at the header level, to prevent them being included twice. Just go right ahead and include anything you want in any file :)Code:#ifndef __HEADER_H__ // replace with mangled filename
#define __HEADER_H__
/* code here */
#endif