#define and #ifdef : if def « Macro Preprocessor « C / ANSI-C






#define and #ifdef

//file1.h
#define USD 1

//file2.h
#define UKP 1

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

#if !defined (USD) || !defined (UKP)    
    #error "RROR: NO_CURRENCY rate is specified."
#endif

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


           
       








Related examples in the same category

1.Simple #if example
2.Simple #if/#else example
3.#define, #ifdef #else example