Code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char **array; //2d array of size array[rows][columns]
int i; //index
int rows = 2, columns = 6;
//allocate memory
array = (char **) malloc (sizeof (char*) * rows);
for(i=0;i < rows;i++)
array[i] = (char *) malloc (sizeof(char) * columns);
strcpy(array[0],"Hello");
strcpy(array[1],"World");
for(i = 0; i < rows; i++)
printf("Array[rows] = %s\n",array[i]);
//release memory
for(i=0;i<rows;i++)
free(array[i]);
return 0;
}
Does this help son?