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

前端 未结 17 1190
温柔的废话
温柔的废话 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:43

    From what I recall, it's based on the size of a memory address. So on a system with a 32-bit address scheme, sizeof will return 4, since that's 4 bytes.

提交回复
热议问题