What should be the sizeof(int) on a 64-bit machine? [duplicate] What should be the sizeof(int) on a 64-bit machine? [duplicate] c c

What should be the sizeof(int) on a 64-bit machine? [duplicate]


Size of a pointer should be 8 byte on any 64-bit C/C++ compiler, but not necessarily size of int.


Doesn't have to be; "64-bit machine" can mean many things, but typically means that the CPU has registers that big. The sizeof a type is determined by the compiler, which doesn't have to have anything to do with the actual hardware (though it typically does); in fact, different compilers on the same machine can have different values for these.


Not really. for backward compatibility it is 32 bits.
If you want 64 bits you have long, size_t or int64_t