Subj : Re: multi-dimensional array/pointer help To : borland.public.cpp.borlandcpp From : "detritus" Date : Fri Apr 09 2004 07:52 pm I get the gist of what you are saying. What I would like to do is pass an elements such as char *num[2][2] to a function that is not constrained by the size of the array num. for example, what I was hoping would work is this: /* function prototype */ void fun(char ***ptr); /* what this dose dosen't realy matter */ char *num[2][2] = {{"One","Two"},{"Three","Four"}}; /* initialize the array */ fun(num); /* use fun to do something with the array */ So how do I go about that? "Bob Gonder" wrote in message news:pn1c705f5gq7rlhdbku1s440iosgmf49g2@4ax.com... > 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; > >} > .