Help me wrap my head around pointers and iterators.

Pages: 123
A pointer is a variable that holds a memory address, so on a 64 bit system it will be 8 bytes, on a 32 bit system it will be 4 bytes.

There aren't any exceptions - If I have an object that is say 500bytes and my system is 64 bit, then the pointer to the object will have a size of 8 bytes. The pointer points to the first memory address of the object.

If I have a variable that is an int, the pointer to it will have size 8 bytes, and points to the memory address of the int.

In my struct example above, the same thing applies to classes. If I had a class that contained 9 ints and 1 double, then the size would be 10 * sizeof double, not 9 * sizeof int + sizeof double.

a pointer is 4 bytes for me on 64-bit W7, but yeah it could be 8.

sizeof(int *) is the size of a pointer, this is bigger than than the size of an int because it holds a memory address.

that was what I was referring to, saying it will always be bigger than the size of an int just because it holds a memory address is wrong
Last edited on
a pointer is 4 bytes for me on 64-bit W7

Sounds like your executable is still being compiled as a 32-bit binary. Not a big issue but worth being aware of.
thanks, didn't really think about it, but I guess its because I'm using the mingw32 that code::blocks came with rather than mingw64 that I could download.

Topic archived. No new replies allowed.
Pages: 123