You are on page 1of 17

CMSC 21

Fundamentals of programming

Kristine Bernadette P. Pelaez

Institute of Computer Science


University of the Philippines Los Baños
Nested
Structures
Structures

collection of related data


of different types
referenced by a single name.
Nested Structures

a structure can
contain another structure
as its member
as long as it is NOT its self.
Nested Structures

person
name birthdate age
Nested Structures

name
first middle last
Nested Structures

birthdate
month day year
Nested Structures

person
first middle last month day year
age
name birthdate
Nested Structures

DEMO
Array of
Structures
Array of Structures

collection of structures
of the same type
Array of Structures

array of structures
can be created statically
or dynamically just like
in a normal data type.
Array of Structures

struct person humans[100];

data type
Array of Structures

struct person humans[100];

data type array name


Array of Structures

struct person humans[100];

data type array name size


Array of Structures

DEMO
CMSC 21
Fundamentals of programming

Kristine Bernadette P. Pelaez

Institute of Computer Science


University of the Philippines Los Baños

You might also like