to malloc, you should do
Code:
schedule= malloc (sizeof(struct taskList));
also, your struct should have an array of chars (this makes strings) instead of just a single char, which would be one instead of many. Your code looks like this:
Code:
struct taskList {
char task;
int time;
char preReq;
};
It should look like
Code:
struct taskList {
char task[30]; //30 is just a random number; it should be whatever you want or what
//your assignment requires
int time;
char preReq[30]; //same as above
};
With that change, you should change from
"%c" to %s"
for example
Code:
scanf("%s %d %s", schedule->task, &schedule->time, schedule->preReq);
but like someone said, you dont HAVE to make a pointer and malloc it. You can just make a direct structure and then access its variables like this
Code:
schedule.task, schedule.time,...