subject

Please write this in C. Regarding the following linked lists: typedef struct _orderList{ foodNode *head; // Pointer to first food item for the order (alphabetical) int count; // Number of food items in the order} orderList;Where foodNode is defined astypedef struct _foodNode{ char *data; // Food Item Name struct _foodNode *next;} foodNode;You will provide the following functions to operate on orderLists:orderList *createItem(). Creates (using dmalloc() -- see below) an instance of an orderList struct, initializes its fields and returns a pointer to the newly allocated struct. int insert(char *str, orderList *s). Places a new string in the orderList by inserting a new foodNode into its linked list and increments count. The food items will be inserted into the orderList in alphabetical order (use strcmpi() below for this). Duplicate strings (ignoring case) will not be allowed in the orderList. Returns 0 if the insertion was successful, and 1 otherwise. void printItems(orderList *s). Displays the elements of the orderList with each string on a new line. You may find the following two functions useful:/* compares strings for alphabetical ordering */int strcmpi(char *s, char *t){ while (*s && tolower(*s) == tolower(*t)) { s++; t++; } return tolower(*s) - tolower(*t);}/* allocates memory with a check for successful allocation */void *dmalloc(size_t size){ void *p = malloc(size); if (!p) { printf("memory allocation failed\n"); exit(1); } return p;}Always check the pointer returned by malloc() for successful memory allocation. You may use the dmalloc() function above in place of malloc() to ensure that this is always done. You may also find it convenient to write a function char *stringcopy(char *s) which creates (with dmalloc()) a copy of the string parameter.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
Which are examples of note-taking tools? check all that recording devices sticky notes digital highlighters paper flags highlighting pens digital displays digital flags
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Which of the following is an example of intellectual properly! oa. new version of a novelb. journal of ideasc. pages of a bookood. lines of a poem
Answers: 2
question
Computers and Technology, 22.06.2019 21:00
Which of these is most responsible for differences between the twentieth century to the twenty-first century?
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
You know the right answer?
Please write this in C. Regarding the following linked lists: typedef struct _orderList{ foodNode *h...
Questions
Questions on the website: 13722359