0
What is the type ,used in C to store user birthday
Language C
2 ответов
0
It's up to you what type to use to store user birthday.
For storing date and time in c language usually used time_t type, (which represents the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC) and struct tm (whcih contains date and time broken down into its components).
You can store it as string (array of chars), or as time_t.
It depends on what you are going to do with that birthdays.
If you are going to compare them, filter and so on it is better to use time_t.
But if you are going only storing and showing it you can use string representation.
Or you can define your own type (struct)
0
An array of int[3] index 0 for date index 1 for month index 2 for year.
Or a struct?
Or just put evrrything in int/long or a char*