/*
구조체안에 구조체를 이룬 복합 구조체
*/
//날짜 구조체 선언
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;
};
//복합구조체를 사용할 변수
struct date_and_time today;
today.sdate.month = 6;
today.sdate.day = 9;
today.sdate.year = 2010;
today.stime.hour = 20;
today.stime.minutes = 43;
today.stime.seconds = 28;
NSLog(@"print of today : %i-%i-%i %i:%i:%i", today.sdate.month, today.sdate.day, today.sdate.year, today.stime.hour, today.stime.minutes, today.stime.seconds);