c - Can't wrap my head around Preprocessing Macros -


i'm still struggling macros in c.

so 1 should return -2:

#define #define c int main() {     int =     #ifdef     #ifdef b // if , b defined         -1     #else    // defined , b not defined         -2     #endif     #else   // not defined         -3     #endif     ;     printf("%d \n", i); } 

why isthis returning -3 then:

#define b #define c int main() {     int =     #ifdef     #ifdef c         -1     #else         -2     #endif     #else         -3     #endif     ;     printf("%d \n", i); } 

it seems me if macros have own logic.

#include <stdio.h> #include <stdlib.h>  #define #define c int main() {     int =     #ifdef     #ifdef b // if , b defined         -1     #else    // defined , b not defined         -2     #endif     #else   // not defined         -3     #endif     ;     printf("%d \n", i); } 

in case -2, since defined b not defined


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -