quote:Original post by graveyard filla
thanks tal, i didnt think calling new would change the value of the pointer which called it... i guess it makes sence though since your asking for a new hunk of memory, so technically, when you do this:
int *some_int;
this is a pointer which not only points to garbage, but also STORES garbage?
thanks for clearing things up.
ps - to the other guys, thanks for your help but i already solved the problem, it was because of the pointer changing when i called new, read my other post
Your mental model of pointers is giving you the wrong idea. pointers are nothing more than variables that hold addressess, just like an integer is a variable that holds whole signed numbers. It doesn't physically point to memory inside your computer it just makes it easier to think that way. Techincally you could just as well use integers to store the address but it isn't a good idea of course.
[edited by - snk_kid on June 11, 2004 7:32:00 PM]