20120113

How to use pointer in C++


//Program in c to learn pointer in C, pointer1.cpp

#include<iostream>
using namespace std;
int main()
{
int *ptr1, **ptr2, a; //note thatptr2 is ptr to ptr
ptr1=&a;
ptr2=&ptr1;
cout<<"Adress of a is : \n"<<ptr1<<"\n";
cout<<"Address of ptr1 is: \n"<<ptr2<<"\n";
return 0;
}
Previous                             Home                               Next

No comments:

Post a Comment