Program to illustrate Pointer

#include <iostream.h>
#include<conio.h>
void main()
{
    int i=5,*p,**pp;
    clrscr();
    p=&i;
    pp=&p;
    cout<<"Value of i : "<<i;
    cout<<"\nValue of i : "<<*p;
    cout<<"\nValue of i : "<<*(&i);
    cout<<"\nValue of i : "<<**pp;
    cout<<"\nValue of i : "<<i<<"\n";

    cout<<"\nAddress of i : "<<&i;
    cout<<"\nAddress of i : "<<p<<"\n";

    cout<<"\nValue of p : "<<p;
    cout<<"\nValue of p : "<<*(&p);
    cout<<"\nValue of p : "<<*pp<<"\n";

    cout<<"\nAddress of p : "<<&p;
    cout<<"\nAddress of p : "<<pp<<"\n";
    cout<<"\nValue of pp : "<<pp<<"\n";
    cout<<"\nAddress of pp : "<<&pp;
    getch();
}

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|