I came to use a variable of type uint16_t
, but am unable to use that data type because of my project limitations. Is it possible to unsigned short int
instead of uint16_t
?
I don't know the difference between both of them. Could anybody clarify please?
C Programming – Difference Between uint16_t and Unsigned Short Int on 64-bit Processor
c++linux
Best Answer
uint16_t
is unsigned 16-bit integer.unsigned short int
is unsigned short integer, but the size is implementation dependent. The standard only says it's at least 16-bit (i.e, minimum value ofUINT_MAX
is65535
). In practice, it usually is 16-bit, but you can't take that as guaranteed.Note:
uint16_t
.inttypes.h
andstdint.h
are both introduced in C99. If you are using C89, define your own type.uint16_t
may not be provided in certain implementation(See reference below), butunsigned short int
is always available.Reference: C11(ISO/IEC 9899:201x) §7.20 Integer types