Advantages
- Pointer reduces the code and improves the performance, it is used to retrieving strings, trees, etc. and used with arrays, structures, and functions.
- We can return multiple values from a function using the pointer.
- It makes you able to access any memory location in the computer's memory.
Uses of Pointer
1) Dynamic memory allocation
In C++ language, we can dynamically allocate memory using malloc() and calloc() functions where the pointer is used.
2) Arrays, Functions, and Structures
Pointers in C++ language are widely used in arrays, functions, and structures. It reduces the code and improves the performance.