#IF #ELSE #ENDIF : Preprocessor IF « Macro Preprocessor « C / ANSI-C






#IF #ELSE #ENDIF

//file1.h
#define USD 1

//file2.h
#define UKP 1

//file3
#include <stdio.h>
#include <file1.h> 
#include <file2.h> 

#if (defined (USD))  
    #define currency_rate 46
#else
    #define currency_rate 100 
#endif 

main() {    
  int rs;
  rs = 10 * currency_rate;
  printf ("d\n", rs);
}


           
       








Related examples in the same category

1.IF and endif preprocessor
2.ifdef preprocessor