I have this struct:
typedef struct
{
char name[3];
int month_num;
int day_num;
int day_size; // amount of days that are field in with tasks.
char *task[40];
}
month; // each month contains a name, its num in the calendar and days.
and I need to assign memory allocation for it. I was able to assign the memory for the struct itself:
mon = (month*)malloc(12 * sizeof(month));
But I am having trouble to do it the same for the char *task[40].
I tried a lot of possibilities, but non of them worked...
char temptask[40];
mon->task=malloc(strlen(temptask)+1);