Tuesday, July 14, 2009

C Passing a 3-D array of char strings to a function?

So I have a 3-D array of char strings -


char* val[256][256][256];





I need to pass a reference of this to a function, how do I do this?


If it was a single array I can pass it as follows


char* val[256]


func(val);


....


void func(char** a){}





However


void func(char**** a){}


doesnt work.





Any suggestions?

C Passing a 3-D array of char strings to a function?
int stPar (char a[5][5][5])


int stPar2 (char *a[256][5][5])


------


both of this work fine.


=====================================


Some thing to know more is in C





char *a;


char b[256][256];


a = b;





Works just as fine. The multiple index only indicates amount of memory. You can still pass as char * and then assign to deceleration as 3d array and it will work fine.


No comments:

Post a Comment