Hello, please give me the code for this project in C Programming. Thank you. Ren
ID: 3829989 • Letter: H
Question
Hello, please give me the code for this project in C Programming. Thank you.
RentalInfo * freeList(RentalInfo *list) ;
This function should remove all nodes from the given linked list (i.e. the linked list should become empty) and returns the value NULL.
Car ID Car Make Car Model Year Unit Price Per Day MPG
-----------------------------------------------------------------------------------------------------------------
311 Chevrolet Chevelle-Malibu-1 2014 45.99 21
312 Buick Skylark-320 2014 79.95 19
313 Plymouth Satellite 2017 61.75 N/A
314 AMC Rebel-SST 2016 99.99 16
315 Ford Torino 2015 85.99 22.1
316 Ford Galaxie-500 2016 61.95 29.5
317 Chevrolet Impala 2013 42.99 18.7
318 Plymouth Fury-iii 2017 69.85 20.52
319 Pontiac Catalina 2012 29.99 N/A
320 AMC Ambassador-DPL 2015 95.99 16.30
321 Citroen DS-21-Pallas 2016 59.75 19.05
Explanation / Answer
Hi, Please find my implementation.
Please let me know in case of any issue.
RentalInfo * freeList(RentalInfo *list){
if(list == NULL)
return NULL;
RentalInfo *temp = NULL;
while(list != NULL){
temp = list;
list = list->next;
delete temp;
}
return NULL;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.