| < Day Day Up > |
|
Arrays are the workhorses of data structures. An understanding of arrays, their declaration, their use, and their manipulation, presents a wealth of programming possibilities. No longer will you be limited to modeling data as individual objects; with arrays you will have the power to manipulate collections of objects.
The primary focus of this chapter is to give you a thorough understanding of array basics. You will learn what arrays are, how they are represented in memory, how to declare single- and multi-dimensional arrays, and how to manipulate them. The material presented here builds on what you learned in chapters 5 through 7. You will continue to expand your knowledge of pointers by learning how to create arrays dynamically using the new[] operator. The secondary focus of this chapter is to give you a good understanding of when to use an array — and when not to.
Since a formal discussion of user-defined data types occurs later in chapter 10, the examples in this chapter will use arrays of fundamental data types such as char, int, or float only. I took this approach to keep the discussion focused on the topic of arrays, however, the principles learned here will apply to arrays of user-defined data types as well.
| < Day Day Up > |
|