I’m having trouble figuring out how to declare a pointer to an array of arrays of void*. (I can’t use STL containers and the like because it’s an embedded system.)
I have some data that I’m trying to group together in a structure. Mostly built-in data types, but then are these two arrays. The first one,
char *testpanel_desc[] = {...};
isn’t a problem. In my structure I store a pointer to this array like so:
struct MyStruct
{
...
char** panelDesc;
};
But then there’s this one:
void *testpanel_pointers[][4] = {...};
and I can’t come up with a way to define a member of my structure that I can assign this array to. void*** doesn’t work because of the 4 in the original declaration.
Make life a bit simplier and use typedefs
Or equivalent
I doubt you know what the following means, but suffice it to say it’s equivalent too
Note that based on type, it is not a “a pointer to a two dimension array of void*”, much like
char**is not a “pointer to a one dimension array of char*”. But keeping the way you do it in the one-dimension case (pointing to the first element), this is the declaration you need.