O'Reilly logo

Object-Oriented Programming with C++ by A.K. Sharma

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

2

POINTERS

2.1 INTRODUCTION

Pointers are one of the most important features of C++. The beginners of C and C++ find pointers hard to understand and manipulate, though the treatment of pointers in C++ is comparatively simpler than in C. In an attempt to unveil the mystery behind this aspect, the basics of pointers that generally remain in background are being discussed in the following sections.

2.1.1 The & Operator

When a variable x is declared in a program, a storage location in the main memory is made available by the compiler. For example, Fig. 2.1 shows the declaration of x as an integer variable and its storage location in the main memory.

Figure 2.1 The variable x and its equivalent representation in memory

From Fig. 2.1, it may be observed ...

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