I have something like:
static const char *array[] = {
"One String",
"Second String",
"Third",
"etc",
};
I want to define a new string variable new_var and initialize it with the first string in array. So array[0]. So something like:
static const char new_var[] = &array[0];
However the error from the compiler is invalid initializer on this line.
I am trying to initialize the variable outside the scope of any functions and so would prefer not to use any string.h functions like strcpy etc.
Please suggest any tricks which might be used here.
Would be helpful if you posted the actual error, but, your types were wrong, so that's probably the problem. Instead, try:
static const char* new_var = array[0];