Question: In c source code: Question 1: Define a struct pet with properties name, age, weight, and type. Use appropriate data types for the different properties.

In c source code:

In c source code: Question 1: Define a struct pet with properties

Question 1: Define a struct pet with properties name, age, weight, and type. Use appropriate data types for the different properties. You may assume that the strings will never be longer than 19 chars. Don't forget to add an extra char for the NULL character that terminates the strings. Question 2: Using a single line of code, define and initialize a variable "pl" storing a pet with appropriate values. pl On the next line in the main, create a pointer called "ptP1" that points to the pet pl. Next, print the name of the pet to screen using the pointer ptrP1. Print the age of the pet to screen using the variable int mainOt //define your pet "pl" I/define the pointer "ptrP1" /print the name using ptrP1 print the age using pl Question 3 Write a function "changeWeight" that takes pet and a new weight as the input to the function. Hint: Should the pet be passed by value or reference? I/ write you changeWeight function below

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!