Chapter 8 Arrays and Strings
Objectives
Objectives (cont’d.)
Slide 4
Introduction
Arrays
Accessing Array Components
Accessing Array Components (cont’d.)
Slide 9
Processing One-Dimensional Arrays
Processing One-Dimensional Arrays (cont’d.)
Array Index Out of Bounds
Array Initialization During Declaration
Partial Initialization of Arrays During Declaration
Some Restrictions on Array Processing
Arrays as Parameters to Functions
Constant Arrays as Formal Parameters
Base Address of an Array and Array in Computer Memory
Functions Cannot Return a Value of the Type Array
Integral Data Type and Array Indices
Other Ways to Declare Arrays
Searching an Array for a Specific Item
Sorting
Selection Sort (cont’d.)
Auto Declaration and Range-Based For Loops
C-Strings (Character Arrays)
C-Strings (Character Arrays) (cont’d.)
Slide 28
String Comparison
Reading and Writing Strings
String Input
String Output
Specifying Input/Output Files at Execution Time
string Type and Input/Output Files
Parallel Arrays
Two- and Multidimensional Arrays
Slide 37
Slide 38
Two-Dimensional Array Initialization During Declaration
Two-Dimensional Arrays and Enumeration Types
Processing Two-Dimensional Arrays
Initialization
Print
Input
Sum by Row
Sum by Column
Largest Element in Each Row and Each Column
Passing Two-Dimensional Arrays as Parameters to Functions
Arrays of Strings
Arrays of Strings and the string Type
Arrays of Strings and C-Strings (Character Arrays)
Another Way to Declare a Two-Dimensional Array
Multidimensional Arrays
Summary
Summary (cont’d.)
Slide 56
Slide 57