I was hoping someone may be able to help me. What I want to do is basically perfrom an if statement to check if a varaible has been declared. If it has, then perform some code, if not don't perform the code.
Now I have tried my best to research this, but all I can find is #ifdef, which only seems to work if you declare a variable as #define.
What I have got is:
- file_a.h (int varname; )
- file_b.c (I DO NOT #include file_a.h)
I can't use #define because this only works if I am using the #ifdef in a file that includes the header file where the variable is declared #define, and in this case I am not.
I want to say in file_b.c:
if (varname exists)
Is this possible??? Any help would be much appreciated