Question: Write a program called mypet s in which a typedef structure called PET is defined. PET contains a char array called pet _ type ,

Write a program called mypets in which a typedef structure called PET is defined. PET contains a char array called pet_type, a char array called name, and an unsigned int called age. You should use calloc() to create an array size 3 of pointers to PET, and malloc() to create three elements of PET with addresses stored in the array of pointers created with calloc(). Then, use the pointer to PET array to ask the user to input the pet_type, name and age of the three animals. Finally, the program should output the pet information using again the array of pointers. Make sure the program frees at the end all memory dynamically allocated.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!