Question: Without compiling and running it, write an expression (in a cpp file as comments) that can be used to access (or print) the structure members


Without compiling and running it, write an expression (in a cpp file as comments) that can be used to access (or print) the structure members in each of the following: a) planet_number of structure planet_record. b) planet_number of the structure pointed to by planet_ptr. c) planet_name of structure planet_record. d) planet_name of member structure pointed to by planet_ptr. e) age of the structure member personal of structure planet_record. f) age of member pointed to by personal_ptr of the structure pointed to by planet_ptr. g) origin of the structure member personal of structure planet_record. h) origin of member pointed to by personal_ptr of the structure pointed to by planet_ptr. 2. Now have your group member check your answers. After that, let's confirm them by writing them in code. Define the above structure and initialize the members with suitable values. Then compile and see how many of your answers had syntax errors? Report the number of errors \{in comments\}. Also fix the code to ensure that it works properly. You can leave your old code in comments. 3. Now let's do a little more extra work by updating your code (and testing it) to do the following: a) Initialize all members of all 5 planets stored in all_records and print them neatly. b) Create a pointer that would point to dynamically allocated array of records of 5 planets (similar to all_records[5]). Again, initialize all of its members and print them neatly using the newly created pointer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
