Question: Please program in C The purpose of this lab is to learn how to save and access information in a structure Create a struct cars
Please program in C


The purpose of this lab is to learn how to save and access information in a structure Create a struct cars with the following members: char brand[40]; char model[40]; char color 40 int year double price; In the main function, declare an array named car of structure type cars. Here car is the normal structure variable. Firstly, prompt the user to enter the number of cars. Then, read the user inputs for brand, model, color, year, and price for the car count entered and save the information in the array. Once information is saved in the array, print the information back to the screen After that, declare a pointer variable ptr and assign the car array address to it. Here 'ptr' s the pointer structure variable. Now, using the ptr variable, print the information to the output. Hint: Use dot operator to save and access members of a structure. Use right arrow to save and access information in a structure when using a pointer. Note: The information printed using car and ptr are both the same.You may change the name of the structure and its members. An example illustrating interaction with the program is given below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
