Pointers in C++ :

Pointer Definition :

C language Pointer Definition, Declaration or Expressions - The variable that stores the address of another variable is what in C++ in called pointer. Pointer are a very powerful feature of the language that has many uses in lower level programming.

Benefits of using Pointers in C++ :

  • Pointers save the memory.
  • Pointers reduce the length and complexity of program.
  • Pointers allows passing of arrays and strings to functions more efficiently.
  • Pointers makes possible to return more than one value from the function.
  • Pointers increase the processing speed.

Example :

  1. /* Description: print 'a' address values step by step */
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. int n=10, *ptr;
  7. ptr = &n;
  8. cout << "Address of n variable: " << &n << endl;
  9. cout << "Address stored in pntr variable: " << ptr << endl;
  10. cout << "Value of *pntr variable: " << *ptr << endl;
  11. }

Output :

C++ language print 'a' address values step by step

Computer Science Engineering

Special Notes

It's a special area where you can find special questions and answers for CSE students or IT professionals. Also, In this section, we try to explain a topic in a very deep way.

CSE Notes