Computer Programming in C Chapter 6 2005 년 가을학기 부산대학교 전자전기정보컴퓨터공학부.

Slides:



Advertisements
Similar presentations
Incomplete Structs struct B; struct A { struct B * partner; // other declarations… }; struct B { struct A * partner; // other declarations… };
Advertisements

1 Chapter 10 - Structures, Unions, Bit Manipulations, and Enumerations Outline 10.1Introduction 10.2Structure Definitions 10.3Initializing Structures 10.4Accessing.
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
Dynamic Allocation and Linked Lists. Dynamic memory allocation in C C uses the functions malloc() and free() to implement dynamic allocation. malloc is.
Chapter 10 C Structures, Unions, Bit Manipulations, and Enumerations.
Programming in C Chapter 10 Structures and Unions
For(int i = 1; i
1 Records C++ Structs Chapter 14 2 What to do with records?  Declaring records  Accessing records  Accessing the field of a record  What is a union?
Class 15 - Overhead 11Object Oriented Programming Using C #define t_circle 1 #define t_rectangle 2 struct circle_shape {short type; double x,y; double.
Computer Programming in C Chapter 년 가을학기 부산대학교 전자전기정보컴퓨터공학부.
Structures Spring 2013Programming and Data Structure1.
Structs CSE 2451 Rong Shi. Structures Structure – one or more values, called members, with possibly dissimilar types that are stored together – Group.
Data Types C built-in data types –char, int, float, double, int*, etc. User-defined data types: the programmer can define his/her own data types which.
Structures. An array allows us to store a collection of variables However, the variables must be of the same type to be stored in an array E.g. if we.
Chapter 9 Imperative and object-oriented languages 1.
Functions Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng.
1 Lecture 24 Chapter 11 Structured Types, Data Abstraction and Classes Dale/Weems/Headington.
C++ data types. Structs vs. Classes C++ Classes.
Презентація за розділом “Гумористичні твори”
Центр атестації педагогічних працівників 2014
Процюк Н.В. вчитель початкових класів Боярської ЗОШ І – ІІІ ст №4
Structures, Unions, and Typedefs CS-2303, C-Term Structures, Unions, and Typedefs CS-2303 System Programming Concepts (Slides include materials from.
Create your own types: typedef #define N 3 typedef double scalar; /* note defs outside fns */ typedef scalar vector[N]; typedef scalar matrix[N][N]; /*
S-1 University of Washington Computer Programming I Lecture 18: Structures © 2000 UW CSE.
Computer Programming in C Chapter 년 가을학기 부산대학교 정보컴퓨터공학부.
'C' Programming With Structure Records Purpose of structures Coding a structure template Defining a new data type Functions which communicate using structures.
Engineering Computing I Chapter 6 Structures. Sgtructures  A structure is a collection of one or more variables, possibly of different types, grouped.
By Sidhant Garg.  C was developed between by Dennis Ritchie at Bell Laboratories for use with the Unix Operating System.  Unlike previously.
Computer Programming in C Chapter 년 가을학기 부산대학교 전자전기정보컴퓨터공학부.
CSE 332: C++ Type Programming: Associated Types, Typedefs and Traits A General Look at Type Programming in C++ Associated types (the idea) –Let you associate.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
1 STRUCTURES AND POINTERS. 2 A VARIABLE OF THIS COMPOSITE TYPE CAN HAVE MORE THAN ONE VALUE, GROUPED TOGETHER TO DESCRIBE AN ENTITY. THE COMPONENTS OF.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 10 - C Structures, Unions, Bit Manipulations,
ABSTRACT DATA TYPES Data types, data structures, abstract data types, Java/C++ classes, C++ structs.
1 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the structure, union, and enumerated types ❏ To use the type definition.
ECE 103 Engineering Programming Chapter 49 Structures Unions, Part 1 Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE.
 Structures are like arrays except that they allow many variables of different types grouped together under the same name. For example you can create.
Духовні символи Голосіївського району
Topics memory alignment and structures typedef for struct names bitwise & for viewing bits malloc and free (dynamic storage in C) new and delete (dynamic.
Struct Data Type in C++ What Are Structures?
Structures and Union. Review bitwise operations –you need them for performance in terms of space and time –shifts are equivalent to arithmetics enumeration.
Structure A collection of values (members) struct date{ int day; char month[10]; int year; }; Declare a structure variable struct date today; struct struct_name.
chap11 Chapter 11 Structure and Union Types.
Arrays (Chapter 5)‏ Definition Applications One-Dimensional –Declaration –Initialization –Use Multidimensional.
ENEE150 – 0102 ANDREW GOFFIN Abstract Data Types.
Structs in C Computer Organization I 1 November 2009 © McQuain, Feng & Ribbens struct Properties The C struct mechanism is vaguely similar.
1 CSE1301 Computer Programming: Where are we now in the CSE1301 syllabus?
CE-2810 Dr. Mark L. Hornick 1 “Classes” in C. CS-280 Dr. Mark L. Hornick 2 A struct is a complex datatype that can consist of Primitive datatypes Ints,
Chapter 11 Structures, Unions and Typedef 11.1 Structures Structures allow us to group related data items of different types under a common name. The individual.
Chapter 10-1: Structure.
Chapter 8 Arrays, Strings and pointers
Structures and Union.
Проф. д-р Васил Цанов, Институт за икономически изследвания при БАН
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
Електронни услуги на НАП
Боряна Георгиева – директор на
НАЦИОНАЛНА АГЕНЦИЯ ЗА ПРИХОДИТЕ
ДОБРОВОЛЕН РЕЗЕРВ НА ВЪОРЪЖЕНИТЕ СИЛИ НА РЕПУБЛИКА БЪЛГАРИЯ
Съвременни софтуерни решения
ПО ПЧЕЛАРСТВО ЗА ТРИГОДИШНИЯ
от проучване на общественото мнение,
МЕДИЦИНСКИ УНИВЕРСИТЕТ – ПЛЕВЕН
Моето наследствено призвание
Structures and Union.
C Structures, Unions, Bit Manipulations and Enumerations
Structures and Union.
Chapter 10 C Structures and Unions
C++ data types.
Chapter 11 Structure and Union Types.
Presentation transcript:

Computer Programming in C Chapter 년 가을학기 부산대학교 전자전기정보컴퓨터공학부

Computer Programming Chapter 62 6 장. Structure 목차  Structure 기본 개념  Typedef  Structure 를 이용한 Function Parameter  Structure Array  Union  Bitwise Structure

Computer Programming Chapter 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 표지

Computer Programming Chapter 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

Computer Programming Chapter 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 표시