O'Reilly logo

C++ All-In-One For Dummies®, 2nd Edition by Jeff Cogswell, John Paul Mueller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. Working with Arrays, Pointers, and References

In This Chapter

  • Working with arrays and multidimensional arrays

  • Understanding the connection between arrays and pointers

  • Dealing with pointers in all their forms

  • Using reference variables

When the C programming language, predecessor to C++, came out in the early 1970s, it was a breakthrough because it was small. C had only a few keywords. Tasks like printing to the console were handled not by built-in keywords but by functions.

Technically, C++ is still small. So what makes C++ big?

  • The language itself is small, but its libraries are huge.

  • The language is small, but it's extremely sophisticated, resulting in millions of things you can do with the language.

In this chapter, we give you the full rundown of topics that lay the foundation for C++: arrays, pointers, and references. In C++, these items come up again and again.

We assume that you have a basic understanding of C++ — that is, that you understand the material in Minibook I and Minibook II, Chapter 1. You know the basics of pointers and arrays (and maybe just a teeny bit about references) and you're ready to grasp them thoroughly.

Building Up Arrays

As you work with arrays, it seems like you can do a million things with them. This section provides the complete details on arrays. The more you know about arrays, the less likely you are to use them incorrectly, resulting in a bug.

Note

Know how to get the most out of arrays when necessary — not just because they're there. Avoid using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required