Is the size of the pointer always 4?

Asked 2 years ago, Updated 2 years ago, 94 views

On my computer,

sizeof(char*) = 4 sizeof(int*) = 4 sizeof(long long*) = 4

Then does the pointer size have to be 4?

c c++ sizeof memory pointer

2022-09-22 14:22

1 Answers

sizeof(char) == 1 Other than that, there is no fixed size of the data type.

I don't have to This means that there is no guarantee that sizeof(char*) == sizeof(int*).

Typically, on a 16-bit system, the pointer size is 2 On 32-bit systems, 4, On 64-bit systems, it is 8.

But it's not set as the C/C++ standard There is no way to determine the exact size of the pointer until you turn it around on your computer


2022-09-22 14:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.