Starting from:
$30

$24

HW 07 Solution

On March 26, 1945 U.S. Marines raised the U.S. flag

atop Mount Suribachi, during the Battle of Iwo Jima.




Write a program that uses a pointer-based linked

list. You should use the following struct (declared

as a global):




struct node {

int data;

struct node *next;

};




Your program must use a for loop to count from 0

to 9. Your program must insert these into a linked

list such that they can be retrieved in low-to-high

order (note that the example in class retrieved in

high-to-low order).




Your program must display the results using the

following code (from class) without any modifications:




while (current) {

printf("%d\n", current-data);

current = current-next ;

}







Next, your program must prompt the user for a value and

call a linear search function to find that value.

If the value is found, your program must print out

the value. You must use this code to print the value




printf("[%d %d]\n", search, searchList(search, head)-data);

 

and this prototype for the search function:




link *searchList(int value, link *head)







Your program must also correctly free all links

of the list.







REQUIREMENTS:

-------------

1. Your program must run on Linux Mint.




2. Your full name must appear as a comment at the beginning of your

program.




3. Your source code must be named hw7-yourname.c

More products