Question: C PROGRAM: LINKED LISTS typedef struct node_ { int data; struct node_* next; }node; node *insertathead(node *list, int data); Parameters: List: a pointer to the

C PROGRAM: LINKED LISTS

typedef struct node_ {

int data;

struct node_* next;

}node;

node *insertathead(node *list, int data);

Parameters:

List: a pointer to the head of a single linked list

Data: the number to be inserted into the head of the linked list

Return: the new head of the linked list

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 using the insert_at_head() function using the contents of the file.

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.txt:

1

2

3

4

5

Sample output:

[jlz6w7@tc.rnet.missouri.edu ~]$ ./a.out input4.txt

5->4->3->2->1->NULL

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!