Вы находитесь на странице: 1из 2

C integer types

As it seems most C programmers are too lazy to look this up in the (freely available) authoritative documentation, here is the list of standard integer types from the ISO/IEC C99, and their format strings. All types are defined in <stdint.h> while the format string macros are defined <inttypes.h> (which includes <stdint.h> by the way). Type unsigned char signed char unsigned short short unsigned int unsigned long long unsigned long long long long uint8_t int8_t uint16_t int16_t uint32_t int32_t uint64_t int64_t ptrdiff_t size_t ssize_t uintmax_t intmax_t uintptr_t Decimal "%hhu" "%hhi" or "%hhd" "%hu" "%hi" or "%hd" "%u" "%i" or "%d" "%lu" "%li" or "%ld" "%llu" "%lli" or "%lld" "%"PRIu8 "%"PRIi8 or "%"PRId8 "%"PRIu16 "%"PRIi16 or "%"PRId16 "%"PRIu32 "%"PRIi32 or "%"PRId32 "%"PRIu64 "%"PRIi64 or "%"PRId64 "%ti" or "%td" "%zu" "%zi" or "%zd" "%ju" "%ji" or "%jd" "%"PRIo64 "%"PRIx64 or "%"PRIX64 "%"PRIo32 "%"PRIx32 or "%"PRIX32 Printing format string Octal Hexadecimal "%hho" "%hhx" or "%hhX" "%ho" "%o" "%lo" "%llo" "%"PRIo8 "%"PRIo16 "%hx" or "%hX" "%x" or "%X" "%lx" or "%lX" "%llx" or "%llX" "%"PRIx8 or "%"PRIX8 "%"PRIx16 or "%"PRIX16

"%zo" "%jo"

"%zx" or "%zx" "%jx" or "%jx"

Printing format string Decimal Octal Hexadecimal intptr_t Not available. Use/Cast to (u)intmax_t instead. Scanning format strings (for *scanf() functions) are identical to printing format strings, with the exception that macros are called SCN* instead of PRI*. Type

Вам также может понравиться