Subj : Re: multi-dimensional array/pointer help To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Fri Apr 09 2004 02:35 am detritus wrote: >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? First, it would be /* function prototype */ void fun(char **ptr); It doesn't matter how many [ ] you have, they only account for One * (the char* is the other one). Second, the function "fun" sees the array as single dimension. You could do void fun( char**ptr, int one, int two) { for( i=0; i