How to use #ifdef conditional inclusion in C

1 Answer

0 votes
#include <stdio.h>
 
#define VAL 2
 
int main(void)
{
    #ifdef VAL
        printf("yes\n");
    #else
        printf("no\n");
    #endif
    
    return 0;
}

 
/*
run:

yes

*/

 



answered Aug 23, 2016 by avibootz

Related questions

1 answer 248 views
1 answer 127 views
127 views asked Aug 23, 2016 by avibootz
1 answer 140 views
1 answer 243 views
1 answer 214 views
...