Macro Definition and Expansion (#define)

A preprocessor define directive directs the preprocessor to replace all subsequent occurrences of a macro with specified replacement tokens.

A preprocessor #define directive has the form:

>>-#--define--identifier--+--------------------------+---------->
                          |    .-,--------------.    |
                          |    V                |    |
                          '-(----+------------+-+--)-'
                                 '-identifier-'
 
   .----------------.
   V                |
>----+------------+-+------------------------------------------><
     +-identifier-+
     '-character--'
 
 

The #define directive can contain an object-like definition or a function-like definition.

#define versus const

Related References

IBM Copyright 2003