/* * File: * todolist.c */ #include "todolist.h" task *makeNewTask(char *taskname, time_t deadline, int priority) { /* Allocate space for the task. */ task *new = (task *)malloc(sizeof(task)); /* Sanity check. */ if (!new) return (task *)NULL; /* Allocate space for the taskname string. */ new->taskname = (char *)malloc(strlen(taskname)+1); /* Move the string to its space. */ strcpy(new->taskname, taskname); /* Assign other attributes. */ new->deadline = deadline; new->priority = priority; /* Return a pointer to the new task. */ return new; } int printTask(task *tsk) { if (tsk != NULL) /* Return a formatted string containing the task information. */ return (printf("\nName: %s\nDeadline: %sPriority: %d\n", tsk->taskname, ctime(&(tsk->deadline)), tsk->priority)); return 0; } /* Still have to implement this one. */ int getHighestPriority(list ls) {}