What is the difference between define and undefine?

# define and # undef are compiler directives in C and C++. The # define directive creates a definition for something that will be replaced multiple times in the code.

For example:

# define HELLO 5

Creates an association between HELLO and replaces it with 5 in the code (for the compiler only).

The # undef (undefine) counterpart removes the definition from what the compiler sees. It is usually specified when either the definition should no longer be used or when the definition needs to change.