Wednesday, 11 September 2013

C Malloc Multidimensional Char Array

C Malloc Multidimensional Char Array

I would like to dynamically allocate (malloc) a multidimensional character
array in C. The array would have the following format:
char array[3][2] = {
{"one","two"},
{"three","four"},
{"five","six"}
};
Before the array would be created, I would already know the number of rows
and the lengths of all of the characters arrays in the multidimensional
array. How would I malloc such a character array?
Thanks in advance!

No comments:

Post a Comment