sizeof void pointer

前端 未结 5 619
无人及你
无人及你 2020-12-24 07:24

why is sizeof void pointer 2 ?

5条回答
  •  梦毁少年i
    2020-12-24 08:12

    A pointer stores a memory address that points to something else. The size of a pointer depends on your platform. On a 32 bit platform you need 32 bits or four bytes to store a memory address so sizeof any pointer will return 4.

    If sizeof(void*) is 2 you're probably running on a 16 bit platform.

提交回复
热议问题