Pointer in C++

When an object is created from its class, the member variables and member functions are allocated memory spaces. The memory spaces have unique addresses. Pointer is a mechanism to access these memory locations using their address rather than the name assigned to them. You will study the implications and applications of this mechanism in detail in this chapter. Pointer is a variable which can hold the address of a memory location rather than the value at the location. Consider the following statement. This statement instructs the compiler to reserve a…

Read More

Member Dereferencing Operator

In computer programming, a dereference operator, also known as an indirection operator, operates on a pointer variable. It returns the location value, or l-value in memory pointed to by the variable’s value. In the C programming language, the dereference operator is denoted with an asterisk ( * ). For example, in C, we can declare a variable M that holds an integer value, and a variable *ptr that holds a pointer to an integer value in memory: In C++ Programming we have three different dereferencing operators. Pointer to a member…

Read More