3 ms·
data types with varying width per platform (C) How many bytes in a char,byte, int, .... ? (answer is: it depends )
by toolslive 5y ago
data types with varying width per platform (C)
How many bytes in a char,byte, int, .... ? (answer is: it depends )
- khoobid_shoma 5y agoActually, for a good reason, it depends! The standard specifies how to get useful information. There are also exact-width, minimum-width. fastest minimum-width, greatest-width,... integer types.
- pavlov 5y agoI don't really know what would have been a better solution at the time. In the early '70s, the native word size of computers varied in increments that feel unfamiliar today: DEC's line-up already contained 16-bit and 18-bit computers, and vendors were looking at 32-bit and 36-bit. C's solution was to define int as at least 16 bits long (but assumed to be the native word size), and char as at least 8 bits long (though it might be stored in a 9-bit half-word on an 18-bit machine, or even a full word on another type of machine).