Download presentation
Presentation is loading. Please wait.
Published byLynne McLaughlin Modified over 9 years ago
1
Computer Programming in C Chapter 6 2005 년 가을학기 부산대학교 전자전기정보컴퓨터공학부
2
Computer Programming Chapter 62 6 장. Structure 목차 Structure 기본 개념 Typedef Structure 를 이용한 Function Parameter Structure Array Union Bitwise Structure
3
Computer Programming Chapter 63 1. Structure 의 기본 개념 복합적인 데이터 Example: StudentScore, StudentName, StudentYear … Structure 의 이용 struct student { intscore; intyear; charname[50]; }; struct studentstudents[100]; int studentScore[100]; int studentYear[100]; char*studentName[100] students[i].score=40; students[i].year=4; strcpy(student[i].name,”Lik”); structure 의 member 표지
4
Computer Programming Chapter 64 2. Typedef Typedef User-Defined Type : cf. Built-in Type More convenient than struct struct student { intscore; intyear; charname[50]; }; struct studentstudents[100]; typedef struct { intscore; intyear; charname[50]; } student; studentstudents[100]; New type
5
Computer Programming Chapter 65 3. Struct 와 Function Parameter Structure 를 이용한 Function 의 Parameter 매우 단순 Typedef 는 가능한 header file 에 정의 Pointer to Struct float Vector10Norm(float v1, float v2, float v3, …, v10) float Vector10Norm(struct vector10 vector) typedef struct { intscore; intyear; charname[50]; } student; student*students; students=malloc(10*sizeof(student)); for(i=0;i<10;i++) { students->year=0; students->score=0; students++; } structure 의 member 표시
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.