구조체란 여러가지 자료형을 묶어놓은 집합적인 자료형이다. 구조체의 정의 1 struct 구조체명 2 { 3 int x ; 4 int y ; 5 } 구조체의 선언 1 struct animal 2 { 3 ... 4 } dog , cat ; 1 struct animal 2 { 3 ... 4 } 5 ... 6 struct animal dog , cat ; 구조체의 초기화 1 struct animal 2 { 3 int color ; 4 ... 5 } dog = {.., .., ..}; 구조체의 멤버 구조체의 멤버를 사용하려면 .연산자를 사용한다. 1 dog . color ; 구조체를 멤버로 가지는 구조체 필요한만큼 .연산자를 사용하면 된다. 1 record . topleft . x = 100 ; 배열을 멤버로 가지는 구조체 1 record . x [ 1 ] = 100 ; 포인터를 멤버로 가지는 구조체 구조체의 배열 1 struct animal dog [ 100 ]; 2 dog [ 1 ]. color ; 구조체의 포인터 -> : 구조체 포인터의 멤버 연산자 1 struct part * p_part ; 2 struct part gizmo ; 3 p_part = & gizmo ; 4 p_part -> number = 100 ; 자료형의 정의 1 typedef struct 2 { 3 ... 4 } animal ; 5 6 animal dog , cat ;