im trying to learn pointer n the &(no idea the specific name for it); so my question is..
im passing the memory address of P to changePTR, why p is not taken the address of o(lets assume o is dynamic allocated), or even i want to change p to NULL. but p in main is still keeping the address of k?
can anyone refer sum good tutorial for learing pointer and memoery location stuffs.... they are so confusing >.<
#include <iostream>
using namespace std;
void changePTR(int* p){
int z = 100;
int* o = &z;
p = o;
// p = null // this doesnt work also..??
}
int main(){
int k = 1;
int* p = &k;
int* q = p;
changePTR(p);
cout<<p<<" and "<<&k<<" and "<<&q<<endl;
}