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

Next Update

Loading...

Currently we improved our website User Interface and other contents. Our next update is adding video tutorials on this site so, We create a new YouTube channel, our YouTube channel name is CodeX.

We need some time for make video tutorials (CodeX) so, stay with us and keep supporting and you know already we make a Collaboration with HackIsOn YouTube channel long time ago So, please Subscribe Our Channels