/*
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
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:
Post a Comment