Originally Posted by Dae
Alright,
Saying *ptr = new int is 'dereferencing' the pointer, which means before it was just ABLE to point to a memory location, now it actually HAS a memory location.. and therefor is just like a normal int, but has special differences. In your example forget that whole 'a' variable you have there, that has nothing to do with your 'ptr' pointer.
Can you assign a value to "int* ptr;" declaration? (eg. int* ptr = 50) no, because it has no memory to put a definition. So you put 'ptr = new int' which means it gives ptr the memory location a standard int has, and therefor you can now treat it like an int. You would have to set values using '*ptr = 50' or '*ptr = b' (and int b = 50 lets say), and you can change its memory address just like a normal pointer.. so therefor you basicly just have a normal int (a dereferenced int pointer). The only difference I think is that you can "delete" the memory location of the ptr, which would make it a standard pointer again.
Hope I wasnt too unclear.