Sunday, March 17, 2013

Pointer Double Dereferencing

#include<iostream>
using namespace std;
int main()
{
    int num=10;
    int *ptr=&num,**ptr1=&ptr;
    cout<<"num: "<<num;
    cout<<"\n&num: "<<&num;
    cout<<"\nptr: "<<ptr;
    cout<<"\n&ptr: "<<&ptr;
    cout<<"\n*ptr: "<<*ptr;
    cout<<"\n*ptr1: "<<*ptr1;
    cout<<"\nptr1: "<<ptr1;
    cout<<"\n**ptr1: "<<**ptr1;
    return 0;
}

0 comments:

Post a Comment