Question: please code in C -1. For the following problem define a struct queueNode with data of type char *. Also define a struct queue with

please code in C

-1. For the following problem define a struct queueNode with data of type char *. Also define a struct queue with two pointers: one for the head and one for the tail. Both pointers are struct queueNode * types. Implement the following operations for your queue data structure:

1. isEmpty() a predicate function which checks to see if the queue is empty; returns true if the queue is empty; false otherwise

2. enqueue() inserts a node to the tail of the queue; the node is allocated dynamically; returns true if the memory was allocated for a node, false otherwise

3. dequeue() deletes a node from the head of the queue; returns the data in the node; precondition: queue is not empty (isEmpty () must be called before dequeue () is called)

4. printQueueRecursive() recursively prints out the data in the queue

-2. Test your application. In the same project, create one more header file testQueue.h and source file testQueue.c (for a total of at least five files). The testQueue.h file should contain function prototypes for test functions you will use on your queue functions. The testQueue.c source file should contain the implementations for these test functions. You will have at least one test function per application function. For example, you will have an application function called enqueue() (or a function very similar) that is used to insert a node into the tail of the queue. In this task, you will need to create a test function called testEnqueue() that passes in various data directly into enqueue() to see if it works as intended. You will also want to test these functions on empty and non-empty queues.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!