I want to create a matrix of weekly timetable which must have 8 rows and 5 rows. And each string has 10 chars. It's possible to do that with malloc like that:
char ***Schedule = (char ***)malloc(ROW*sizeof(char **));
for (int i = 0; i < ROW; i++)
{
Schedule[i] = (char **)malloc(COL*sizeof(char *));
for (int j = 0; j < COL; j++)
Schedule[i][j] = (char *)malloc(SIZE*sizeof(char));
}
But I want to not use malloc, because it seems too much lines of code and size of matrix is very little already (8*5*10 = 400 bytes).
char Schedule[8][5][10];
The above code doesn't work.
char *Schedule[8][5];
This one works but i don't trust it, because size of strings are uncertain. It may crash.