pointer notes
pointer notes
==================
#include<iostream>
using namespace std;
int main(){
//int a;
//cout<<&a<<endl; // & address of operator -- memory location represents
int a = 10;
int *b;
b = &a;
return 0;
}
----------------
#include<iostream>
using namespace std;
int main(){
cout<<ptr<<endl; //5dfdf5d5f454
cout<<*ptr<<endl; // first element ki value 50
cout<<*(ptr+2)<<endl; //68
cout<<*(ptr-2)<<endl; // gives garbage value
return 0;
}
----------------------------
//pointer to pointer
#include<iostream>
using namespace std;
int main(){
ptr1 = &value;
ptr2 = ptr1;
return 0;
}