Search notes:

Preprocessor: Unimportant order of macro definition

The order of definitions of nested macros is unimportant.
#include <stdio.h>

#define NUMBER         FORTY_TWO
#define FORTY_TWO             42

#define FIVE                   5
#define ANOTHER_NUMBER      FIVE


int main() {

  printf("NUMBER         is %2d\n",         NUMBER);
  printf("ANOTHER_NUMBER is %2d\n", ANOTHER_NUMBER);

}
Github repository about-cpp, path: /preprocessor/macros/unimportant-order-of-definition.c
The program prints
NUMBER         is 42
ANOTHER_NUMBER is  5

See also

Preprocessor: macros

Index