Question: Write a function in c , called age _ difference ( ) that takes two Person variables as parameters and returns the difference in age

Write a function in c, called age_difference() that takes two Person variables as parameters and returns the difference in age in years as an integer.
Suppose that Person is defined as follows:
typedef struct{
char name[50];
int birth_year;
} Person;
If two people were defined as
Person y ={"Greg",1972);
Person b ={"Anthony",1963);
Then age_difference(y, b) should return 9. age_difference should always return a positive value or zero.
Please note: you should not write a main() function. Assume that all necessary #include statements, the main function, and the printf statements to display output have all been implemented. You should write only the age_difference function.

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!