// This tut contains pointers in c++
#include<iostream>;
using namespace std;
int main(){
int a=5;
int* b=&a;
// & is a (address of) operator
cout<<"The address of a is : "<<&a<<endl;
cout<<"The address of a is : "<<b<<endl;
// * is a (value at) deference operator
cout<<"The value assigned to address b is : "<<*b<<endl;
// Pointer to pointer
int** c= &b;
cout<<"The address of b is : "<<&b<<endl;
cout<<"The address of b is : "<<c<<endl;
cout<<"The value at address c is : "<<*c<<endl;
cout<<"The value of object assigned at address c is : "<<**c<<endl;
return 0;
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.