Question
C Program Linked lists Description: typedef struct node_ { int data; struct node_* next; }node; void print_list(node* list); Parameters: list: A pointer to the head
C Program Linked lists
Description:
typedef struct node_ {
int data;
struct node_* next;
}node;
void print_list(node* list);
Parameters:
list: A pointer to the head of a single linked list
Return: none
See example output, prints out the linked list
void free_list(node* list);
Parameters
list: A pointer to a single linked list
Return: None
This function should free each node in the linked list
node* create_list(char* file);
Parameters:
file: The name of the input file
Return: The head of the linked list
This function will open the input file and will build a linked list by malloc()ing a node for each of the numbers and linking them together.
int main(int argc, char* argv[]);
Main will read in an input file as a command line argument and then create a linked list, print it out and then free it.
Input file:
1050 2050 2270 3050 3280 3330 3380 4050 4320 4520 4850 4970 4980
Sample output:
[jlz6w7@tc.rnet.missouri.edu ~]$ ./a.out input4.txt
1050->2050->2270->3050->3280->3330->3380->4050->4320->4520->4850->4970->4980->NULL
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