Question: You will define a struct for the linked list that will have the following data members: Character arrays for the first name ( size 5
You will define a struct for the linked list that will have the following data members:
Character arrays for the first namesize last namesize major size and preferred method of communication size
An instance of the struct that represents the birthday
A pointer keeping track of the next node in the list
The birthday struct will have monthsize dayint and yearint
Files:
You will create functions.h functions.c and driver.c files.
driver.c
Main will be included in driver.c Driver.c should have minimal amount of code in it Things you may
have in the driver:
Create the input and output file pointers. These file names will be given on the command line.
Use assert to check for the correct number of command line arguments.
Open your input and output files and check that they opened correctly. use assert
Call the function createList to create and fill your linked list with input data.
Call printList to print out the linked list
Free memory from the linked list by calling deleteList.
Your driver should not have more code than necessary. DO NOT include functions.c in your driver.c file.
As a rule, you should not include c files. Points will be deducted if you have excessive code in
driver.c
functions.h
This file contains the declaration of the structs, all #includes, and the function prototypes. You must
also include header guards. Before each function prototype, you must have a detailed description of
what the overall function does. What the parameters were and what is being returned. Here is an
example of an overall function description.
You are required to have this type of comment block before each function in the h file.
functions.c
Parameters: img imaget pointer array holding the image data for
each of the input files
Return: output imaget struct containing output image data
This function averages every pixels rbg values from each of the
input images and puts those averages into a single output image
You will implement all functions in this file.
Functions:
Below I will provide a short description of each function:
nodet createListFILE nodet This function is called in main driverc and starts the process of
creating the list. The first argument will be a file pointer to your input file and the second will be a
double pointer to the head of your list. Use a loop to read from your input file, calling readNodeInfo
for each node and then calling add to add that node to the list. After all of the information from the
input file has been added to the list, return a pointer to the list.
void addnodet node, nodet head This is the function used to add the node to the linked list.
You will take in two parameters, a double pointer to the node you want to add and a double pointer to
the head of the list. You should check if the list is empty, if not add the node to the list. You are
required to print out the data in the order it is read in so add the node to the end of your linked list.
nodet readNodeInfoFILE inputcalled by createList This function will read the data from the
input file, returning a pointer to the populated node. Use malloc to allocate the memory for the node
that will eventually be added to the linked list. Using scanset conversion, read the data and store it in
the node allocated. You must use scanset conversion to read ALL the data, not just part of the data.
Points will be deducted if you do not use scanset to read all input data. HINT: Scanset reads
information as a character, but you will be reading in some data that are numbers. You will need to use
the C provided function atoi ascii to int to convert the character to integers.
void printListFILE nodet This function prints, to the output file, the data from the list. If the list
is empty you are required to print a message, to stderr, indicating the list is empty and exit the
program. If the list is not empty you are to print LIST INFO: then print the information for each node in
the list. See example below for the required format. Described below is a function called printBorder
which prints a line of asterisk You will call this function before printing the list and after printing
the list.
An example of the print format:
Example:
LIST INFO:
Name: Jane Doe
Date of Birth: January
Degree: CISBS
Preferred method of communication: email
Then the next info
Then the next info
void printBorderFILE This function prints, to the output file, asterisk
void deleteListnodet After you are finished with the nodes in the list you need to give the
memory back to the system. That is what this function does.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
