Define macro inside the main function : Macro Constant « Macro Preprocessor « C / ANSI-C






Define macro inside the main function

  
#include <stdio.h>

void f(void);

int main(void)
{
  #define LIGHTSPEED 186000

  f();

  return 0;
}

void f(void)
{
  printf("%ld", LIGHTSPEED);
}


           
       








Related examples in the same category

1.Use Macro
2.Define Macro: TRUE and FAlSE
3.Define macro: constant
4.Define constant in Macro for loop controlDefine constant in Macro for loop control
5.Define constant in MacroDefine constant in Macro
6.Define Macro and use it as the loop condition
7.Define macro for string and output
8.Define marco based calculation
9.Define header file name in macro