3ce Subj : Re: multi-dimensional array/pointer help To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Thu Apr 08 2004 08:25 pm detritus wrote: >It should read : > >> int main() >> { >> char *num[2][2] = {{"One","Two"},{"Three","Four"}}; >> char ***numPtr; >> numPtr = num; >> return 0; >> } > >What I would like to know is why the following code works and the above >dosent: Too many **s. If you say char num[2]; Then "num" is a char* If you say char two[2][3]; Then "two" is still a char* If you say char*num[2][2]; Then "num" is a char** Trying to put a char** into a char*** doesn't work. That's why the below code works and the above doesn't. Nothing to do with the extra[] or "Three","Four" parts. "num" contains 4 pointers to char, not 4 pointers to pointers to char. >int main() >{ > char *num2[2] = {"One","Two"}; > char **num2Ptr; > num2Ptr = num2; > return 0; >} . 0