Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++. Given the following struct declaration: struct Student { * name; gpa; }; Implement 2 functions: 1. Student ** createStudentList(char ** names, int size); -

C++. Given the following struct declaration:

struct Student

{

* name;

gpa;

};

Implement 2 functions:

1. Student ** createStudentList(char ** names, int size); - function creates an array of pointers to Student objects dynamically. It allocates Student objects and set their name as the passed in names and gpa as 0. size is the number of names available. You can allocate 2*size as many pointers to Student objects just in case you need to add more to the list. For the extra spots in the array, set them to nullptr. The function returns the pointer to the Student pointer array.

2. bool destroyStudentList(Student ** studentList, int size); - function deletes all the Student objects in the array along with their dynamically allocated data members, such as name. It also releases the array of the pointers to the Student objects. The function returns true if the operation is successful and false if studentList contains nullptr.

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

Explain all drawbacks of application procedure.

Answered: 1 week ago

Question

Explain the testing process of accounting 2?

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago