Posted: Sun Feb 12, 2012 7:12 am Post subject: Pointer vs address ?
I really don't get the difference between a pointer and an address, is an address always the same or does it change every time your program loads ?
Sorry for being a noob lol _________________
Some values are just values. For instance, if I want to store "12384" in memory, I do not need to take an address to point to 12384 because I can just store 12384. These are primitive types. You will know their final size at compile time. These will always be the same because of how programs are structured. They are stored on the program stack.
Some can not be stored like that (don't know size at compile time) or just arent. These are objects assigned by the new operator and have their addresses put onto the heap at runtime. You do not know where they are going to be in the heap but you do know that you will have an address that's going to point to them.
tldr; dynamically allocated heap variable versus stack variable. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum