Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

struct quest { int * ptr; char c; }; // elsewhere in the program quest q; int p

ID: 3556899 • Letter: S

Question

struct quest

{

       int * ptr;

       char c;

};

// elsewhere in the program

quest q;

int p = 7;

q.ptr = &p;

q.c = '4';





For the quest structure in the above question:

A. Declare a pointer to the quest structure called pQuest.

B. Create a dynamic array of 4 quest structures using the pQuest pointer. Make sure all variables are ready for the assignments in part c. (6 points)



2. Assuming that parts a and b of Question 7 are in main, draw a memory diagram of the situation after 7.b has been done.

Explanation / Answer

a. Declare a pointer to the quest structure called pQuest.**

quest *pQuest;

b. Create a dynamic array of 4 quest structures using the pQuest pointer. Make sure all variables are ready for the assignments in part c.

pQuest = new quest[4];

2nd question

you can draw 4 separate quest structures numbered [0] - [3] all in an array, being pointed at by pQuest