This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Chapter 12 Arrays Chapter 12 ARRAYS CHAPTER GOALS To be able to declare a one-dimensional array. To be able to perform fundamental operations on a one-dimensional array: assign a value to an array component. access a value stored in an array component. fill an array with data, and process the data in the array. To be able to initialize a one-dimensional array in its declaration. To be able to pass one-dimensional arrays as arguments to functions. To be able to use arrays of records and class objects. To be able to apply subarray processing to a given one-dimensional array. To be able to declare and use a one-dimensional array with index values that have semantic content. To be able to declare a two-dimensional array. To be able to perform fundamental operations on a two-dimensional array: access a component of the array. initialize the array print the values in the array process the array by rows process the array by columns To be able to declare a two-dimensional array as a parameter. To be able to view a two-dimensional array as an array of arrays. To be able to declare and process a multidimensional array. CHAPTER OUTLINE I. One-Dimensional Arrays A. Declaring Arrays B. Accessing Individual Components C. Out-of-Bounds Array Indexes D. Initializing Arrays in Declarations E. (Lack of) Aggregate Array Operations F. Examples of Declaring and Accessing Arrays G. Passing Arrays as Arguments Background Information : C, C++, and Arrays as Arguments H. Assertions About Arrays I. Using Typedef with Arrays II. Arrays of Records and Class Objects A. Arrays of Records B. Arrays of Class Objects III. Special Kinds of Array Processing A. Subarray Processing B. Indexes with Semantic Content IV. Two-Dimensional Arrays 229 Chapter 12 Arrays V. Processing Two-Dimensional Arrays A. Sum the Rows B. Sum the Columns C. Initialize the Array D. Print the Array VI. Passing Two-Dimensional Arrays as Arguments VII. Another Way of Defining Two-Dimensional Arrays VIII. Multidimensional Arrays IX. Problem-Solving Case Study : Comparison of Two Lists X. Testing and Debugging A. Testing and Debugging Hints XI. Summary GENERAL DISCUSSION This chapter introduces the array a structured collection of values, all of the same type and stored under a single name, that are accessed through a value called an index. The array is the first of the structured types that the students will see. Each one-dimensional array has two types associated with it: a component type and an index type (which must be an integral type). Associating two types with a single identifier not to mention multiple values is a radical concept for most students....
View Full Document
This note was uploaded on 06/13/2011 for the course CSC 140 taught by Professor Lebre during the Spring '04 term at Moraine Valley Community College.
- Spring '04
- Computer Science