First of all, if you want 30 strings of up to 20 characters each, then your declaration should be the other way around, and you need an extra char for each null terminator (the character that ends a string):
char axx0[30][21]; // 30 strings of up to 20 character
Now for a little lesson on arrays/pointers. If you have a normal 1D array such as this:
This declaration does a few things... it makes a pointer to char (type is char*), allocates space for 10 chars somewhere in memory, and then makes the pointer point to the first char in that allocated space. The pointer is named myString. So really, myString is of type char*, a pointer to char. Now when you do something like
, what happens is it dereferences the myString pointer, moves 2 positions in memory, and puts the character 'A' there. Essentially myString[0] is the same as *myString, and myString[2] would be the same as *(myString + 2);
Now, when we move to 2D arrays, something similar happens. When we declare
, it makes a pointer to a pointer of char (type is char**) which is the variable axx0. Space is allocated for 30 pointers to char (char*), and axx0 will point to the first of those. Then, space is allocated for 21 characters for each pointer to char that was created, each pointer points to the first character of the corresponding 21 character sequence in memory.
So, getting to the point, axx0 is a char**. If you want to send the 2D array to a function, you simply send axx0. The function should look like one of the following:
void myFunction( char myArrayOfStrings[30][21] );
OR
void myFunction( char myArrayOfStrings[30][] );
When accepting a multi-dimensional array as a parameter to a function, you must at LEAST include the size of each dimension except the last. You have the option of including the size of the last dimension if you wish.