복합구조체와 배열
struct date
{
int month;
int day;
int year;
};
struct time
{
int hour;
int minutes;
int seconds;
};
struct date_and_time
{
struct date sdate;
struct time stime;
};
int i=0;
//복합 구조체의 배열 선언
struct date_and_time days[10];
for( i=0; i<10; i++ ){
days[i].sdate.month = i+1;
days[i].sdate.day = (i+1)*3;
days[i].sdate.year = 2010;
days[i].stime.hour = 20;
days[i].stime.minutes = 30 * (i+1);
days[i].stime.seconds = 30 * (i+1) - 60;
NSLog(@"%i-%i-%i %i:%i:%i", days[i].sdate.month, days[i].sdate.day, days[i].sdate.year, days[i].stime.hour, days[i].stime.minutes, days[i].stime.seconds);
}