You seem to have allocated a 2D array of
char
instead of a 2D array of strings. However this may or may not be what you intended. You've tagged the question as C++ but seem to be writing 'C'. A more C++ way of doing this might include amongst other lines:-
#include <vector>
using namespace std;
vector< vector< string > > ArrayOfArrayOfStrings;
vector< string > FirstArrayOfStrings;
FirstArrayOfStrings.push_back( string("A") );
ArrayOfArrayOfString.push_back( FirstArrayOfStrings );
The good part is all the
malloc
ing gets done for you along with all the
free
ing so your program doesn't leek memory and there are no more hard coded fixed limits or 'magic' numbers in your code.
The down side is you will need to put in some hours to understand and use
iterator
s to do the outputting of the
vector
properly.