WHAT YOU WILL LEARN IN THIS CHAPTER:
How to use arrays
How to declare and initialize arrays of different types
How to declare and use multidimensional arrays
How to use pointers
How to declare and initialize pointers of different types
The relationship between arrays and pointers
How to declare references and some initial ideas on their uses
How to allocate memory for variables dynamically in a native C++ program
How dynamic memory allocation works in a Common Language Runtime (CLR) program
Tracking handles and tracking references and why you need them in a CLR program
How to work with strings and arrays in C++/CLI programs
How to create and use interior pointers
So far, we have covered all the fundamental data types of consequence, and you have a basic knowledge of how to perform calculations and make decisions in a program. This chapter is about broadening the application of the basic programming techniques that you have learned so far, from using single items of data to working with whole collections of data items.
In this chapter, you'll be using objects more extensively. Although you have not yet explored the details of how they are created, don't worry if everything is not completely clear. You'll learn about classes and objects in detail starting in Chapter 7.
You already know how to declare and initialize variables of various types that each holds a single item of information; I'll refer to single items ...