Is the sizeof(some pointer) always equal to four?

前端 未结 17 1401
温柔的废话
温柔的废话 2020-11-22 11:49

For example: sizeof(char*) returns 4. As does int*, long long*, everything that I\'ve tried. Are there any exceptions to this?

17条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 12:30

    The reason the size of your pointer is 4 bytes is because you are compiling for a 32-bit architecture. As FryGuy pointed out, on a 64-bit architecture you would see 8.

提交回复
热议问题