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, 21.06.2019 16:00
This statement accurately describes how headlines should be placed in business documents.
Answers: 3
question
Computers and Technology, 22.06.2019 16:30
Technician a says that a dry sump system uses no oil storage sump under the engine. technician b says that a wet sump system uses no oil storage sump under the engine. who is correct?
Answers: 3
question
Computers and Technology, 23.06.2019 00:20
Ihave been given the number of guns per 100, and the total firearm-related deaths per 100,000. i have to find the actual number of guns per country and actual number of gun-related deaths. if somebody could show me how to do 1 question, i can finish the rest, i am just confused. tia
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
You know the right answer?
Please write this in C. Regarding the following linked lists: typedef struct _orderList{ foodNode *h...
Questions
question
Mathematics, 08.01.2021 21:50
question
English, 08.01.2021 21:50
question
Mathematics, 08.01.2021 21:50
question
English, 08.01.2021 21:50
question
Mathematics, 08.01.2021 21:50