Size of int in C on different architectures
C99, in stdint.h, defines types like int8_t
and int16_t
.
What you want is <stdint.h>
, which compilers that conform to the C standard ("C99") will implement. Unfortunately, this does not include Microsoft. Fortunately, an open-source project provides a <stdint.h>
for Windows, see msinttypes.
This will allow you to use int32_t
and uint32_t
, plus 8, 16, and 64, and many others.
Note: the header file itself is not optional in the standard, however, most of the types in the header are individually optional. Some are not. The most commonly used types are the optional ones, but nothing stops you from using the required ones. The thing is, if an implementation provides the header at all, in practice they define all of the types.