struct

구조체를 배우고 나면 본격적으로 자료구조 공부 시작이다. 함께 알아보자. 구조체? 타입이 다른 데이터를 묶어서 표현하는 방식. 구조체 형식 struct 구조체이름 { 항목1; 항목2; ... }; 예시 struct studentTag { char name[10]; int age; double gpa; }; 구조체 선언 방식 struct 구조체이름 구조체 변수; 예시 struct studentTag s; 구조체 멤버 설정 strcpy(s.name, "kim") s.age = 20; s.gpa = 4.3; 또 다른 방법 #include typedef struct studentTag { char name[10]; int age; double gpa; } student; int main(void) { stude..
평범한컴과생
'struct' 태그의 글 목록