Question: 8. A beginning C programmer was using multiple different arrays to store the properties for the planets in our solar system. A more experienced programmer
8. A beginning C programmer was using multiple different arrays to store the properties for the planets in our solar system. A more experienced programmer suggested using structures instead, which the first programmer then applied with much success. Below are the different types of data for the planets. Each planet has: - a name (a string) - a diameter (a floating point value) - an equivalent number of Earth days required for the planet to orbit the sun (an integer) Tasks for you to complete: Finish the definition for a Planet structure that the beginning programmer used instead of separate arrays. a. b. Create a Planet structure for each of 2 planets c. For extra credit, write the C code to define an array of Planet structures, and save each completed Planet in the array. Use a for-loop to access and display the name of each planet in the array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
