I have a 2-dimensional array of pointer to char and initialising it in a header file.
The problem is this: it doesn't complain getting assigned a const char[]
but does not like me assigning const char*
(as shown in the code). It gives me an error "initializer element is not constant".
const char lang[8] = "English";
const char * langPtr = "English 1";
const char * optionPtr[3][10] = {
{lang, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
{langPtr, 0, ...},
{...}
};
I thought lang
and langPtr
are both pointing at the beginning of a string so should be able to do this. I want to use a pointer to initialise the 2D array. Is there anyway of doing this globally?