elibraryportal Logo

Pointer in C++

In C++ Pointer is a variable that holds the address of another variable. They have data type just like variables,


How to declare a pointer?



Address of var: 0x7ffd51ee949c
Address of var: 0x7ffd51ee949c
Address of p: 0x7ffd51ee94a0
Value of var: 10

Advantage of pointer

1) Pointer reduces the code & improves the performance, it is used to retrieving strings, trees etc. and used with arrays, structures and functions.

2) return the multiple values from function using pointer.

3) We are enable to access any memory location in the computer's memory.

Next Topic