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:40
Design a pos circuit that displays the letters a through j on a seven-segment indicator. the circuit has four inputs w, x, y, and z which represent the last 4 bits of the uppercase ascii code for the letter to be displayed. thus, if wxyz = 0001 then "a" will be displayed. (any answer with 22 or fewer gates and inverters, not counting any for the inputs, is acceptable)
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. a company is currently focusing on creating specific management goals for itself. which level of maturity is the company demonstrating under the sse_ccm framework? a. performed informally b. planned and tracked c. quantitatively controlled d. well-defined e. continuously improving
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
question
Computers and Technology, 23.06.2019 19:00
Now you’re on your own. include a short summary of this section with plots in your lab report. write a matlab script file to do steps (a) through (d) below. include a listing of the script file with your report. 1 the soundsc(xx,fs) function requires two arguments: the first one (xx) contains the vector of data to be played, the second argument (fs) is the sampling rate for playing the samples. in addition, soundsc(xx,fs) does automatic scaling and then calls sound(xx,fs) to actually play the signal. mcclellan, schafer, and yoder, dsp first, 2e, isbn 0-13-065562-7. prentice hall, upper saddle river, nj 07458. c 2015 pearson education, inc. 4 mcclellan, schafer and yoder, signal processing first. prentice hall, upper saddle river, new jersey, 2003. c 2003 prentice hall. (a) generate a time vector (tt) to cover a range of t that will exhibit approximately two cycles of the 4000 hz sinusoids defined in the next part, part (b). use a definition for tt similar to part 2.2(d). if we use t to denote the period of the sinusoids, define the starting time of the vector tt to be equal to t , and the ending time as ct . then the two cycles will include t d 0. finally, make sure that you have at least 25 samples per period of the sinusoidal wave. in other words, when you use the colon operator to define the time vector, make the increment small enough to generate 25 samples per period. (b) generate two 4000 hz sinusoids with arbitrary amplitude and time-shift. x1.t / d a1 cos.2
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, 26.04.2021 01:30
question
Computers and Technology, 26.04.2021 01:30
question
Mathematics, 26.04.2021 01:30
question
Physics, 26.04.2021 01:30
Questions on the website: 13722360