intN_t(3type)

✨ intN_t β€” the fixed-width integer types bestie era ✨

okay so real talk, this is intN_t(3type) from the Linux man-pages, and it's literally the page that explains C's fixed-width integer types. it's giving "I know exactly how many bits I am and I'm not sorry." πŸ’… let's get into it.


πŸ’– NAME πŸ’–

intN_t, int8_t, int16_t, int32_t, int64_t, uintN_t, uint8_t, uint16_t, uint32_t, uint64_t β€” the fixed-width basic integer types. no cap, exactly N bits, that's the whole personality. πŸ¦‹


🌸 LIBRARY 🌸

Standard C library (libc). the classic. the blueprint. πŸ‘‘


✨ SYNOPSIS ✨

#include <stdint.h>

typedef /* ... */ int8_t;
typedef /* ... */ int16_t;
typedef /* ... */ int32_t;
typedef /* ... */ int64_t;

typedef /* ... */ uint8_t;
typedef /* ... */ uint16_t;
typedef /* ... */ uint32_t;
typedef /* ... */ uint64_t;

#define INT8_WIDTH   8
#define INT16_WIDTH  16
#define INT32_WIDTH  32
#define INT64_WIDTH  64

#define UINT8_WIDTH  8
#define UINT16_WIDTH 16
#define UINT32_WIDTH 32
#define UINT64_WIDTH 64

#define INT8_MAX     /*  2**(INT8_WIDTH - 1) - 1   */
#define INT16_MAX    /*  2**(INT16_WIDTH - 1) - 1  */
#define INT32_MAX    /*  2**(INT32_WIDTH - 1) - 1  */
#define INT64_MAX    /*  2**(INT64_WIDTH - 1) - 1  */

#define INT8_MIN     /*  - 2**(INT8_WIDTH - 1)     */
#define INT16_MIN    /*  - 2**(INT16_WIDTH - 1)    */
#define INT32_MIN    /*  - 2**(INT32_WIDTH - 1)    */
#define INT64_MIN    /*  - 2**(INT64_WIDTH - 1)    */

#define UINT8_MAX    /*  2**INT8_WIDTH - 1         */
#define UINT16_MAX   /*  2**INT16_WIDTH - 1        */
#define UINT32_MAX   /*  2**INT32_WIDTH - 1        */
#define UINT64_MAX   /*  2**INT64_WIDTH - 1        */

#define INT8_C(c)    c ## /* ... */
#define INT16_C(c)   c ## /* ... */
#define INT32_C(c)   c ## /* ... */
#define INT64_C(c)   c ## /* ... */

#define UINT8_C(c)   c ## /* ... */
#define UINT16_C(c)  c ## /* ... */
#define UINT32_C(c)  c ## /* ... */
#define UINT64_C(c)  c ## /* ... */

like, look at all those #defines. organized. gorgeous. main character energy for real. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so intN_t are signed integer types of a fixed width of exactly N bits, where N is the value specified in the type's name. they are be capable of storing values in the range [INTN_MIN, INTN_MAX], substituting N by the appropriate number. πŸ’œ

and uintN_t are unsigned integer types of a fixed width of exactly N bits, again with N being the value specified in the type name. they're capable of storing values in the range [0, UINTN_MAX], substituting N by the appropriate number. ✨

According to POSIX, [u]int8_t, [u]int16_t, and [u]int32_t are required; [u]int64_t are only required in implementations that provide integer types with width 64; and all other types of this form are optional. so like, your faves int8_t/int16_t/int32_t are always invited to the party, int64_t is invited if the platform can handle it, and the rest are lowkey optional plus-ones. πŸ™ˆ

The macros [U]INTN_WIDTH expand to the width in bits of these types (N). πŸ“

The macros [U]INTN_MAX expand to the maximum value that these types can hold. πŸ”₯

The macros INTN_MIN expand to the minimum value that these types can hold. πŸ₯Ά

The macros [U]INTN_C() expand their argument to an integer constant of type [u]intN_t. πŸ’«

The length modifiers for the [u]intN_t types for the printf(3) and scanf(3) families of functions are wN, resulting for example in %w64d or %w64i for printing or scanning int64_t values. yes bestie, that w64 is doing the work, don't forget it. πŸ‘‘


🌈 STANDARDS 🌈

C23, POSIX.1-2024. periodt. πŸ’…


🧚 HISTORY 🧚

  • [u]intN_t β€” C99, SUSv2, POSIX.1-2001.
  • [U]INTN_MAX, INTN_MIN, [U]INTN_C() β€” C99, POSIX.1-2001.
  • [U]INTN_WIDTH β€” C23.

Initially, SUSv2 did not include <stdint.h> as a standard header. The [u]intN_t types were instead defined in <inttypes.h>. This was remedied in POSIX.1-2001. so yeah, they used to live in a different house and then moved in. glow-up arc fr. πŸ¦‹


πŸ’œ NOTES πŸ’œ

The following header also provides these types: <inttypes.h>.

<arpa/inet.h> also provides uint16_t and uint32_t. the networking girlies get their own supply. 🌐


⭐ SEE ALSO ⭐

intmax_t(3type), intptr_t(3type), printf(3)


and that's the whole vibe, bestie 🫢🏽 this was Linux man-pages 6.20, dated 2026-02-16, and the page is intN_t(3type). slay, go forth and declare your integers with the exact width you deserve. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms