C++ Pointer

It is possible to take the address of a member of a class and assign it to a pointer. The address of a member can be obtained by applying the operator & to a “fully qualified” class member name. A class  member  pointer can be declared using the operator ::* with the class name.

A C++ Pointer is a variable that holds the  memory address of another variable. The storage and retrieval of data using the memory address of a variable is a faster than that is using variable.

To declare and  refer to a pointer type variable, C++ provides two special unary operator  namely, *  , and &.

void main()
int a;
cout<<"\n The address of a in Memory Location"<<&a<<"is"<<a<<endl;

Result :- 

Use of pointer in C++

Note :- Int a=2 ;
    • This statement tells the C++ compiler to perform the following action :


  • Reserve space in the Memory to hold the integer value.



  • Associate the name a with this memory location.



  • Store the integer value 2 at this location in the memory. The operator ‘&’ is used with the variable to get the address of a variable.



pointer in C++ Language

Follow Us

Contact Us


Back to Top