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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started