Search This Blog

Saturday, 22 February 2014

pointer to pointer concept in C++

/*
 int a;
 int *ptr=&a  // contains the address of the variable a;
 int **ptr2=&ptr // contains the address of the pointer variable *ptr;  
*/


#include<iostream.h>
#include<conio.h>
void main()
{
    int a=2,*ptr,**dblptr;
    ptr=&a;
    dblptr=&ptr;
    cout<<"\nValue of a and address is :"<<*ptr<<"  "<<ptr;
    cout<<"\nValue of pointer to variable is and its value is:"<<dblptr<<"  "<<**dblptr;
    getch();

}

Output



No comments:

Popular Posts