c++ - Can pointers be of different sizes? -
this question has answer here:
- is sizeof(some pointer) equal four? 17 answers
this answer comes interesting statement - "on machines int*
smaller char*
". (let's exclude pointers functions)
is possible pointers different types have different sizes? why useful?
yes, it's entirely possible. on machines, pointer byte contains 2 values: pointer word address of memory word containing byte, , "byte index" gives position of byte within word. e.g. on 32-bit machine, "byte index" 0..3.
this require more storage space "int *", pointer relevant word.
Comments
Post a Comment