Question: IN C PROGRAMMING LANGUAGE: ( Posting this again because the first response was very helpful, but determines the youngest/oldest incorrectly in certain cases ) I'm

IN C PROGRAMMING LANGUAGE: (Posting this again because the first response was very helpful, but determines the youngest/oldest incorrectly in certain cases)

I'm writing a program that reads in a file, stores its information in linked list, and then finds the oldest person in the list, the youngest person in the list, and the amount of birthdays in each month.

As of right now, I have everything working except my function to find the oldest and youngest person.

My structs are typedef struct birthday { int day; int year; char month[50]; } birthday_t; typedef struct node { char firstName[50]; char lastName[50]; birthday_t birthday; char major[50]; char standing[50]; struct node *next; } node_t; typedef struct stats { node_t* oldestPerson; node_t* youngestPerson; int numBirthdays[12]; } list_stats_t; THESE CANNOT BE CHANGED. Month in the birthday struct CANNOT BE AN INT. Please do not change the structs.

The function declaration is list_stats_t getListStats(node_t* head); this cannot be changed. The function must iterate through the linked list to find the oldest person and the youngest person using the information in the structs provided above. I've been working on this for a few hours and can't seem to get everything to calculate properly. The years, months and days must be compared to properly find the oldest and youngest person in the list. I'd appreciate it if someone could help me figure out a good implementation for this. :) Thank you!

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!