Princeton University
COS 217: Introduction to Pgmming Systems

Precept 7c: C Structures

Purpose

Help you learn how to use C structures

C Structures

Structure

Similar to array: collection of items

Different from array: items need not be of the same type

Manipulating C Structures

See C Structures

Defining a structure type

Defining a structure

Initializing a structure

Accessing the fields of a structure

We'll use the arrow operator frequently

Assigning one structure to another

Memberwise assignment

Unlike arrays

Structures as function parameters

Call by value

Unlike arrays

(Optionally) Structures as function return values

Return by value

Copyright © 2008 by Robert M. Dondero, Jr.