#define, #ifdef #else example : if def « Macro Preprocessor « C / ANSI-C






#define, #ifdef #else example


#include <stdio.h>

#define TED 10

int main(void)
{
#ifdef TED
  printf("Hi Ted\n");
#else
  printf("Hi anyone\n");
#endif
#ifndef RALPH
  printf("RALPH not defined\n");
#endif

  return 0;
}

           
       








Related examples in the same category

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