Question
can someone helo Take a look at the following code snippet: struct Person{ char name[BUFSIZ]; char ssn[BUFSIZ]; int age; float height; float weight; }; struct
can someone helo
Take a look at the following code snippet:
struct Person{ char name[BUFSIZ]; char ssn[BUFSIZ]; int age; float height; float weight;
};
struct Person p1;
strcpy(p1.name, "Alfred Morino"); strcpy(p1.ssn, "496-50-2260"); p1.age = 50; p1.height = 170.5;
p1.weight = 70.5;
struct Person *ptr = &p1;
What will be printed by the following expressions?
printf("Name = %s SSN = %s Age = %d Height(cm) = %g Weight(kg) = %g ", p1.name, p1.ssn,p1.age, p1.height, p1.weight);
2 pts
5 pts
4 pts
printf("Name = %s SSN = %s Age = %d Height(cm) = %g Weight(kg) = %g ", ptr- >name, ptr->ssn, ptr->age, ptr->height, ptr->weight);
printf("Name = %s SSN = %s Age = %d Height(cm) = %g Weight(kg) = %g ", (*ptr).name, (*ptr).ssn, (*ptr).age, (*ptr).height, (*ptr).weight);
printf("Name = %s SSN = %s Age = %d Height(cm) = %g Weight(kg) = %g ", (&p1)- >name, (&p1)->ssn, (&p1)->age, (&p1)->height, (&p1)->weight);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started