Question: C program Modify this program (list.c) so it can take a list of integers from command line arguments and create a linked-list. You will need

C program

Modify this program (list.c) so it can take a list of integers from command line arguments and create a linked-list. You will need to implement insert() function. The output of your program should look like this:

C program Modify this program (list.c) so it can take a list

#include #include #include struct node { int n; struct node *next; }; struct node *head = NULL; void print(){ struct node * current = head; while(current!=NULL){ printf("%d ", current->n); current=current->next; } printf(" "); } void insert(int number){ } void dequeue(){ } void pop(){ } void sort(){ } int main(int argc, char * argv[]){ int i; 
for(i=1;i 

Part 2:

Once you are done with Part 1, the next step is to make your list work as a queue or a stack. Your job is to implement two functions: dequeue() and pop(). dequeue() will remove a node from the front of the list pop() will remove a node from the back of the list. The output of your program then should look like this:

gcc -Wall -o list.c list.c ./list 12 99 37 8 65 12 64 insert 12 insert 99 insert 37 insert 8 insert 65 insert 12 insert 64 12 99 37 8 65 12 64

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!