Initializing const array in Struct in C

Code snippet:

static struct { static const unsigned char myConstArray[] = { 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, }; //more.... }_SomeValues; 

How could this work? (complains that after = a; absent)

+4
source share
3 answers

Change to:

 static struct { const unsigned char myConstArray[14]; } _SomeValues = { { 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 58, 58, 59, 60, } }; 
+8
source

you don't have static variables in struct

+1
source

Source: https://habr.com/ru/post/1441578/


All Articles