Structures:
Chapter 4:
Ms. Munazza Mah Jabeen
Assistant Professor of Computer Science
Structures:
A structure is a collection of simple
variables. The data items in a
structure are called the members of
the structure.
• Defining the Structure.
• Syntax of the Structure Definition.
• Use of the Structure Definition.
• Defining a Structure Variable.
• Accessing Structure Members.
• Initializing Structure Members.
• Structure Variables in Assignment
Statements
part2 = part1;
…
A Measurement Example:
Other Structure Features:
• Structures Within Structures.
• Accessing Nested Structure
Members.
• Initializing Nested
Structures.
Room dining = { {13, 6.5}, {10, 0.0} };
• Depth of Nesting.
• Structures and Classes.
Enumerations:
Word Count Example:

Structures

  • 1.
    Structures: Chapter 4: Ms. MunazzaMah Jabeen Assistant Professor of Computer Science
  • 2.
    Structures: A structure isa collection of simple variables. The data items in a structure are called the members of the structure. • Defining the Structure. • Syntax of the Structure Definition. • Use of the Structure Definition. • Defining a Structure Variable. • Accessing Structure Members. • Initializing Structure Members. • Structure Variables in Assignment Statements part2 = part1;
  • 3.
  • 4.
  • 5.
    Other Structure Features: •Structures Within Structures. • Accessing Nested Structure Members. • Initializing Nested Structures. Room dining = { {13, 6.5}, {10, 0.0} }; • Depth of Nesting. • Structures and Classes.
  • 6.
  • 7.