I'm doing a homework assignment for Computing II. It's to create a to-do list of tasks in a dynamically created array of strings that can manipulated in a number of ways. One of the ways it needs to be manipulated is through the addition of a task, or an element of the array through the use of realloc. My code is as follows, and will run until I call the freshly realloc'd array in a different function.
void add_task(char **List, int line_num){
char task[1000];
List = (char**)realloc(List, (line_num+1)*sizeof(char));
List[line_num] = malloc((1000) * sizeof(char));
printf("Please enter the string you would like to use as your new task.\n");
scanf("%s",task);
strcat(task,"\n");
strcpy(List[line_num],task);
return;
}