Initialize static variable with element of const compound literal
问题 Is a const compound literal a valid initializer for a static variable? #define COMPOUND ((const int [2]){1, 2}) static const int x = COMPOUND[0]; /* static const int x = 1; should be equivalent */ EDIT: The possible duplicacte in the first comment doesn't make sense, because I'm asking explicitly about const literals, and not variables. 回答1: Yes, an element of a compound literal may be used as an initializer. C 2018 6.7.9 4 tells us what initializers must be: All the expressions in an