An integer constant is a value that
is determined at compile time and cannot be changed
at run time. An integer constant expression is an
expression that is composed of constants and evaluated to a constant at compile time.
The sizeof operator applied to a variable
length array type is evaluated at run time, and therefore is not a
constant expression.
You must use an integer constant expression in the following
situations:
- In the subscript declarator as the description of an array bound.
- After the keyword case in a switch statement.
- In an enumerator, as the numeric value of an enumeration constant.
- In a bit-field width specifier.
- In the preprocessor #if statement. (Enumeration
constants, address constants, and sizeof cannot be
specified in a preprocessor #if statement.)