C Language Common pitfalls Adding a semicolon to a #define


It is easy to get confused in the C preprocessor, and treat it as part of C itself, but that is a mistake because the preprocessor is just a text substitution mechanism. For example, if you write

/* WRONG */
#define MAX 100;
int arr[MAX];

the code expands to

int arr[100;];

which is a syntax error. The remedy is to remove the semicolon from the #define line. It is almost invariably a mistake to end a #define with a semicolon.