Read OnLine Cpp Program Example
POINTER | |
---|---|
PRAC 3 | PRAC 4 |
//wap to print Address of the varable #include<iostream.h> #include<conio.h> void main() { int i=3; int *j; j=&i; clrscr(); cout<<"\n Address of i="<<&i; cout<<"\n Address of i="<<j; cout<<"\n Address of j="<<&j; cout<<"\n Value of j="<<j; cout<<"\n Value of i="<<i; cout<<"\n Value of i="<<*(&i); cout<<"\n Value of i="<<*j; getch(); } -------output-------- Address of i=0x8f7efff4 Address of i=0x8f7efff4 Address of j=0x8f7efff2 Value of j=0x8f7efff4 Value of i=3 Value of i=3 Value of i=3 |
//wap to print Address of the varable #include<iostream.h> #include<conio.h> void main() { int i=3,*j,**k; j=&i; k=&j; clrscr(); cout<<"\n Address of i="<<&i; cout<<"\n Address of i="<<j; cout<<"\n Address of i="<<*k; cout<<"\n Address of j="<<&j; cout<<"\n Address of j="<<k; cout<<"\n Address of k="<<&k; cout<<"\n Value of j="<<j; cout<<"\n Value of k="<<k; cout<<"\n Value of i="<<i; cout<<"\n Value of i="<<*(&i); cout<<"\n Value of i="<<*j; cout<<"\n Value of i="<<*j; cout<<"\n Value of i="<<**k; getch(); } -------output------- Address of i=0x8f85fff4 Address of i=0x8f85fff4 Address of i=0x8f85fff4 Address of j=0x8f85fff2 Address of j=0x8f85fff2 Address of k=0x8f85fff0 Value of j=0x8f85fff4 Value of k=0x8f85fff2 Value of i=3 Value of i=3 Value of i=3 Value of i=3 Value of i=3 |
Previous | Next |
Download | Download |