Modified answer
// Parses a string 'formatted_date' representing a date
// in format DD-MM-YYYY, DD.MM.YYYY or DD/MM/YYYY
// into a structure date 'parsed_date'.
void parse_formatted_date(char * formatted_date, date * parsed_date)
{
sprintf(formatted_date, "%d-%d-%d",
parsed_date->day,
parsed_date->month,
parsed_date->year);
}
int main(int arg, char *argv[]) {
/*
* Request a date from the user
* in format DD/MM/YYYY
*/
date d;
char input_date[20];
printf("Enter your date of birth in the form DD/MM/YYYY:");
fgets(input_date, 100, stdin);
sscanf(input_date,"%d/%d/%d", &d.day, &d.month, &d.year);
parse_formatted_date(input_date, &d);
printf("date: %s dd = %d, mm = %d, yy = %d\n", input_date, d.day, d.month, d.year);
return 0;
}