In: Computer Science
use C source code to complete the following:
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.
struct pet // structure declaration
{
char name[20];
int age;
float weight;
string type; // Considering type as string assuming that its type of pet
} p1; // creating stucture variable p1.
int main ()
{
struct pet p2; // cerating variable p2 for structure
}
// We can create structure variables as shown in above 2 types ( for p1 and p2)