Ok firstly I'll explain my assignment. For this assignment I have to use dynamic memory allocation which I am having no problems with. What I am having a problem with is figuring out the correct way to work my assignment. For my assignment I need to create a program that prompt the user to enter how many students they have then ask for the following information; Student ID, Birthdate, and Phone number. I need to use a loop to prompt the user to enter all the students information. I need to create a loop that will scan through all the student IDs and find the oldest student using their birthdate (The loop must be able scan through more then 3 students).
Here is my code, I havent done much in it yet because I'm not sure really where to start. I've already setup the dynamic memory allocation, but I don't know how to work the rest of this. Please help me.
Thank you.
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
int * studentData= NULL;
int students;
printf("How many students are you entering records for:\n");
scanf("%d", &students);
studentData=(int*)malloc((sizeof(int)*students));
}
You could define a structure:
Then create an array, where each of those elements is of type studentData:
Then loop through them with:
Use the following struct. You can make year, month and day as separate fields. It will be simpler for a quick start: