Why below line of code is not compiling successfully? const unsigned char *a[]={ "Hello", "Hi" }; const unsigned char *b[]={ a[0], a[1] };
Thanks Mike But I want to ask how can i achieve this type of decleration for array of pointers?Because i am having some same strings in different array of pointers and i have to put only one in my code and want to declare rest of string in the above manner if it is a common for rest of the set.
.
NOT.
That is the wrong question to ask.
It would be far better to describe what you're actually trying to achieve - and then ask for suggestions as to how to do that!
BTW: What on earth made you think that formatting your response as source code would be a good idea??
Because i am having some same strings in different array of pointers and i have to put only one in my code and want to declare rest of string in the above manner if it is a common for rest of the set.
This can be done, but each string must be put in a separate variable. By the way, since we are talking about C51 here, I noticed that you are not using the code keyword for your constant variables. This could be a mistake.
How about something like
const unsigned char str_hello[] = "Hello"; const unsigned char str_hi[] = "Hi"; const unsigned char *a[]={ str_hello, str_hi" }; const unsigned char *b[]={ str_hello, str_hi" };
And, as *** said, consider putting them into CODE space...