Question: This program is IN THE C LANGUAGE and ONLY the C LANGUAGE. I WILL THUMBS UP THE ANSWER IF IT IS CORRECT AND MEETS THE

This program is IN THE C LANGUAGE and ONLY the C LANGUAGE. I WILL THUMBS UP THE ANSWER IF IT IS CORRECT AND MEETS THE BELOW REQUIREMENTS!! :)

PLEASE USE THE PROVIDED FUNCTIONS GIVEN BELOW! Please if possible, have comments within the code so I can understand it! Thank you again a ton in advance

Here are the given C libraries that will be used in this program:

#include

#include

#include

#include

This program will use this linked list node to record a string of (at greatest size), four valid characters:

//define the struct

struct the_string_node {

//String

char string[ 5 ];

//The next

struct the_string_node * nextNode

};

Using this prototype function, create a function that will free the memory occupied by the inputted node. It must free the memory occupied with the inputted node, and return an pointer to the succeeding node in the list; that was headed by the inputted node. Node MUST be a valid string_node that was allocated dynamically:

Note: Do NOT change the prototype!

struct the_string_node * free_used_node(struct the_string_node * inputted_node);

Then using this prototype function, create a function that will make a new linked list (node). It must require the caller to be free (the allocated memory) by using the free_used_node, and it must return NULL if the memory cannot be allocated. The string inputted is at most four valid characters, with either a NULL or a pointer to a the_string_node:

Note: Do NOT change the prototype!

struct the_string_node * new_node(char string [], struct the_string_node * nextNode);

Lastly by using this prototype function, compute an string that represents the content of an inputted linked list (with an provided head node). The parts in the list must be divided by spaces in the created string. Note, the function MUST run O (n) times, with the "n" representing the total length of the linked list (headed by "head").

Example: ("" represents heads, and "/" represents the end)

[hi[]]--> [wow[]]-->[lol[/]]

Will create the string "hi wow lol". There should NOT be a space after the "lol" text.

Note: Do NOT change the prototype!

void connect_the_nodes(struct the_string_node * head , char * string);

For testing this function, it does NOT require any type of user input whatsoever. However please create 2 tests (each) in the main function for new_node and connect_the_nodes by using a combination of the assert and the strcmp commands. Also use free_used_node to free any memory used by the linked lists and use assert to verify that the returned value of free_the_node is correct. Memory allocation failure does NOT need to be tested for.

As one final test, create 6 nodes (with a string length of 1 each) that consists of every vowel in the english alphabet (including Y). Arrange these created nodes in alphabetical order (A first and Y last) and produce this string. Be sure the testing does NOT leak any memory. Don't declare any array or use 6 variables to store the nodes:

Here is the string that should be generated:

A E I O U Y

Again, I WILL THUMBS UP THE ANSWER IF IT IS CORRECT AND MEETS THE ABOVE REQUIREMENTS!! THANK YOU!

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!