0% found this document useful (0 votes)
8 views20 pages

Structures in C++

A structure in C++ is a collection of related data items of possibly different types, defined using the keyword 'struct'. Unlike arrays, which are homogeneous and contain only data of the same type, structures are heterogeneous. This allows for more complex data organization within a single entity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views20 pages

Structures in C++

A structure in C++ is a collection of related data items of possibly different types, defined using the keyword 'struct'. Unlike arrays, which are homogeneous and contain only data of the same type, structures are heterogeneous. This allows for more complex data organization within a single entity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

1

Structures
2
Structures 3

 A Structure is a collection of related data items,


possibly of different types.
 A structure type in C++ is called struct.
 A struct is heterogeneous in that it can be
composed of data of different types.
 In contrast, array is homogeneous since it can
contain only data of the same type.
4
5
6
7
8
9
11
12
Example Code

13

Output

You might also like