Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

35024 Assignment # 1 1) Suppose we have an array to store all the holiday presents we have purchased for this year. Now that the

image text in transcribed
image text in transcribed
35024 Assignment \# 1 1) Suppose we have an array to store all the holiday presents we have purchased for this year. Now that the holidays are over and all the presents have been given out, we need to delete our list. Our array is a dynamically allocated array of structures that contains the name of each present and the price. The name of the present is a dynamically allocated string to support different lengths of strings. Write a function called delete_present_list that will take in the present array and free all the memory space that the array previously took up. Your function should take 2 parameters: the array called present list and an integer, num, representing the number of presents in the list and return a null pointer representing the now deleted list. (Note: The array passed to the function may be pointing to NULL, so that case should be handled appropriately.) struct present \{ char "present_name; float price; i. struct present* delete_gresent_list(struct present* present_list, int num) 2) Suppose we have a singly linked list implemented with the structure below and a function that takes in the head of the list. current =other next; if (current == NULL) \{ head-snext = temp; return head; other next = current->next; current->next = temp; return head; If we call whatDoesitDo(head) on the following list, show the list after the function has finished. head1234567

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

Students also viewed these Databases questions