Is it safe to assume that a pointer is the size of an int in C?

前端 未结 7 912
别那么骄傲
别那么骄傲 2020-12-20 16:52

In designing a new programming language, is it safe to assume that a C int and a pointer are the same size on the machine?

相关标签:
7条回答
  • 2020-12-20 17:30

    I think you mean size of data types as defined by platform not C lang. To best of my knowledge C doesn't define any specific size for the data types. The answer to your question is you can't assume this, for example On win32 sizeof(int) == sizeof(pointer) == 4 bytes however on win64 sizeof(int) == 4 and sizeof(pointer) == 8

    0 讨论(0)
提交回复
热议问题