1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <stdio.h> #include <stdint.h> #include <inttypes.h> typedef int16_t my_type; my_type value = 0xFC7F; int main(int argc, const char * argv[]) { printf("0x%" PRId16 "\n", value); printf("Type uses %lu bytes\n", sizeof(my_type)); return 0; }
1 2
0x-897 Type uses 2 bytes