Hello there, take a look at this code:
Code:
#define macro(a,a1,b,b1) \
#ifdef a \
a1;
#endif \
#ifdef b \
b1; \
#endif
I can't compile this code, i'm sure it's wrong, but it says what i want to do, i.e. :
Code:
macro(Q, printf("Q is defined\n"), W, printf("W is defined\n"));
/* This will be expanded to */
#ifdef Q
printf("Q is defined\n");
#endif
#ifdef W
printf("W is defined\n");
#endif
So, how must i rewrite my macro?
Thanks in advance.