Arrays Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 10 November 2004 Chapter 10
Introduction Arrays A collection of data storage locations, each of which holds the same type of data. Element Ex 11-1: using an integer array Writing past the end of an array Ex 11-2
Initialization and declaration Initialization Declaration Ex 11-3 Read/write in files Arrays of objects Ex 11-4 Multidimensional arrays Initializing multidimensional arrays
Memory Arrays of pointers Declaring arrays of the free stores A pointers to an array versus an array of pointers Pointers and array names Ex 11-7 Deleting arrays on the free store
Char arrays Ex 11-8: filling an array Ex 11-9: filling an array by a whole line Ex 11-10: strcpy Ex 11-11: strncpy