Programming Techniques

Objectives

Problems

Problem

Problem

Structures

Structures

Structures

Structures

struct basics

struct examples

struct examples

Structures Types

Structures Variables

Structures Variables (cont.)

Initializing Structure Variables

Accessing Members of a Structure Variable

Demo: Initializing and Accessing Members

Reading a Structure Member

Assigning Structures

Ex. 1: struct basics

Ex. 2: struct-to-struct assignment

Passing Structures to Functions

Passing Structures to Functions

Passing Structures to Functions (cont.)

Returning Structure from Functions

Kích thước của struct

Arrays of structures

Arrays of structures

Arrays inside structures

Arrays of structures

Arrays inside structures

Array of Structures

Array of Structures (cont.)

Array of Structures (cont.)

Array of Structures (cont.)

Cấu trúc phức tạp

The Arrow Operator (->)

The Arrow Operator (->) (cont.)

Unions

Unions (continued)

Unions (continued)

So sánh struct và union

Example

Example

Nested structures

Bài tập về cấu trúc

Bài tập về cấu trúc

Bài tập về cấu trúc

Bài tập về cấu trúc

Bài tập về cấu trúc

Bài tập về mảng cấu trúc

Bài tập về mảng cấu trúc