Question: Answer the following in C source code I) Create a struct Person with attributes char name[20], int age, double score. Use typedef such that you

Answer the following in C source code

I) Create a struct Person with attributes char name[20], int age, double score. Use typedef such

that you can refer to struct Person using Person. You may assume that no Person has a name longer

than 19 chars, i.e., it will fit into the array of length 20.

II) Write a function Person createPerson(char name[], int age,double score) that returns a person with

attributes as specified by the inputs. (Remember that you have to use a string function to copy over the

name to the the Person.)

III) Write a function void printPerson(Person p) that prints the attributes of the Person p to the screen.

Print the attributes using printf and the format string %s %d %d , i.e., printf(%s %d %d , ...).

Ex.

Name age score

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!