Kindly help,its all 1 question,thumbs up is a must
ECE 361: Computer Organization - Fall 2018 October 31, 2018 Page 5 of 9 Name: Question 2(30 pts)-Cstruct and pointers WARNING: READ THE PROBLEM CAREFULLY, THE ORGANZATION OF THE STACK is SMLAR TO THAT OF PROBLEM ASKS FOR. USE DESCRIPTIVE VARIABLE NAMES AND COMMENT AS APPROPRIATE. In this problem we are going to code small pieces of a stack module that operates on food STACKADT2. CIN C PROGRAMMING: A MODERN APPROACH, BUT II'S NOT THE SAME, PROVIDE WHAT THE items. Each food item has the following structure: typedef struct food_item // name of the food // number of calories per serving // number of servings per, container char namell; int calPerServing; int numservings; ) food itemt; Homework #3 asked you to code a stack module with a fixed size array. Now we'd like you to code the stack with a dynamically allocated array of food items. You can assume the following struct for the stack struct stack_type ( food_item t *contents; /1 the array of food items int top int size; // top of stack pointer // the stack's maximum size (the // the number of food items) struct stack type theStack; You can also assume the availability of a function static void terminate(const char *message) that displays a message and terminates the application Write the following 6 functions (use the starter code on the next 2 pages) int create(int size) allocates space for the food item array and initializes top and size. size is the maximum number of food items that can be stored on the st void destroy(void) - frees up the memory allocated to the food item array and resets top and size to0 bool is_empty(void) returns true if the stack is empty, false otherwise bool is_full(void) that returns true if the stack is full, false otherwise void push(food_item_t item) - pushes item onto the stack. The function should ack terminate if the stack is full food item t pop(void) - that pops the top item on the stack and returns it in a food item struct. The function should terminate if the stack is full. Don't forget to declare a variable to return the food item to. (huk sa