Hi guys i have the following code and i am trying to ask for user input and then calculate the users age from the system date. So if the user enters 01/01/1985 and it compares it to the current date it should say that they are 7374 days old. How could i calculate that i am having difficuly i have exstracted the system date already.
Code:
void calage()
{
char buff[BUFSIZ];
char date[12];
int m,d,y;
char dateTen;
char dateUnit;
char dateTotal;
struct tm t;
time_t now; /* time struct*/
time(&now); /* put time into the &now variable*/
t = *localtime(&now); /* exstract the system time*/
strftime(buff, sizeof(buff), "%d//%m//%y", &t); /* format the string*/
/*printf("m = %d, d = %d, y = %d\n", m, d, y); */
printf("The current date is %s\n",buff); /* print the date to the screen*/
}