Definition of global variables using a non constant initializer

What is the reason behind this?

C(unlike C++) does not allow initialization of global values with non constant values.

C99 Standard: Section 6.7.8:

All the expressions in an initializer for an object that has static storage duration shall be constant expressions or string literals.

Leave a Comment