I read everything and everywhere I could about "compile time constants" in C, and I cannot yet give an explanation to the following:
const short testArray[2]={1,2};
//void IndeedConst(void){ testArray[0]=3; } //correctly reports "error: assignment of read-only location 'testArray[0]'"
const short testItem=testArray[0]; //why "error: initializer element is not constant"??
so the compiler is complaining that testArray[0] is read only/const and at the same time it is stating that testArray[0] is not constant! I did answer myself "evidently the dereferencing operator [ ] cannot work "on compile time" constant initialization, then whyever this lines would compile with no errors?
const short* testItem=&(testArray[1]);
also note that here I am getting the address of the 2nd item in the array. therefore the "compile time" constant initialization can dereference with no problem!
What's an explanation for this?