Cash-back offer from May 2nd to 7th, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 40.00

LAB #9 Practice C Writing Linked List Functions | Complete Solution

Question posted by
Online Tutor Profile
request

LAB #9

Practice C Writing Linked List Functions

Remember, if you need to get Lab #8 graded, you need to show your lab to the TAs within 10 minutes of getting to lab, and you and your partner will not receive lab credit if you do not get checked off before leaving each lab. Once you have a zero on a lab, then it cannot be changed because we have no way of know if you were there or not!!!

Reminder: All of our labs involve paired programming. You do not have to keep the same partner for each lab, but you MUST work with someone in each lab!!! First, find a
partner for this lab. It can be the same partner from the previous lab or a different partner.
Write the linked list functions you’ll need for Assignment #5. Use the following link
to help you understand linked lists and C:


(2 pts) Design pseudocode for linked list functions
Write the implementation for the following header file that will help you use your linked
list easily, i.e. list.c. You want to design a solution on paper first to help you know what
the code and pointers will look like. Here is the list.h file:

struct node {
int val;
struct node *next;
};
int length(struct node *);
void push(struct node **, int); //add to front of list
void append(struct node **, int); //add to rear of list
void print(struct node *, int);
(6 pts) Implement linked list functions
Now, use the code below to test your list.c implementation file with test_list.c. After
you copy it to your own file, compile it with your list.c file, i.e. gcc list.c test_list.c.
 Do you see the values in your list printed in the order you entered them?
 If not, are you getting a segmentation fault? What else might be the error?
 What happens when you use append, rather than push?
#include "list.h"
#include <stdio.h>
#include <stdlib.h>
int main (){
char ans[2];
int num;
struct node *head = NULL;
do {
printf("Enter a number: ");
scanf("%d", &num);
push(&head, num); //Change push to append…
printf("Do you want another num (y or n): ");
scanf("%1s",ans);
} while(ans[0]=='y');
print(head, length(head));
return 0;
}

Available Answer
$ 40.00

[Solved] LAB #9 Practice C Writing Linked List Functions | Complete Solution

  • This Solution has been Purchased 1 time
  • Submitted On 03 Jun, 2015 11:49:04
Answer posted by
Online Tutor Profile
solution
This Tutorial is rated A+ p...
Buy now to view the complete solution
Other Similar Questions
User Profile
Exper...

LAB #9 Practice C Writing Linked List Functions | Complete Solution

This Tutorial is rated A+ previously,if you have any questions regarding this tutorial then you can contact me....

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35