![]() ![]() Regardless of what data type they are pointing to, they have fixed size. On 32- bit machine sizeof pointer is 32 bits ( 4 bytes), while on 64 bit machine it's 8 byte. The answer is simple: Because our pointer is an int-pointer and the size of. If you're going to write something that absolutely has to have a pointers of a certain size, you'd better check it!įunction pointers are a different story - see Jens' answer for more info. In our case here the variable is a pointer hence when we increase its value. It's usually pretty safe to assume they're going to be uniform within a given executable on modern desktop OS's.Įdit: Even so, I would strongly caution against making this assumption in your code. There are some exceptions, like on old 16-bit windows when you had to distinguish between 32-bit pointers and 16-bit. on a 32-bit executable they're usually 32-bit. ![]() Pointers generally have a fixed size, for ex. So the answer is NO - sizes can vary.Īnother example: take an 8051 program, it has three memory ranges and thus has three different pointer sizes, from 8 bit, 16bit, 24bit, depending on where the target is located, even though the target's size is always the same (e.g. ![]() Function Pointers can have very different sizes, from 4 to 20 Bytes on an X86 machine, depending on the compiler. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |