I have a date type defined as typedef char* DateTime; the format is "dd/mm/yyyy-hh:mm" e.g. "08/08/2012-12:00"
and I want to allocate n string that are "dates". What is wrong with the following?
DateTime* dates = (DateTime* ) malloc(sizeof(char*) * n);
for (int i = 0; i <= n; i++) {
dates[i] = malloc(sizeof(char)*16);
if (dates[i] == NULL) {
free(dates);
return NULL;
}
}