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 259 views
1 answer 134 views
134 views asked Aug 23, 2016 by avibootz
1 answer 151 views
1 answer 255 views
1 answer 225 views
...