1intN_t(3type)                                                    intN_t(3type)
2
3
4

NAME

6       intN_t,  int8_t, int16_t, int32_t, int64_t, uintN_t, uint8_t, uint16_t,
7       uint32_t, uint64_t - fixed-width basic integer types
8

LIBRARY

10       Standard C library (libc)
11

SYNOPSIS

13       #include <stdint.h>
14
15       typedef /* ... */ int8_t;
16       typedef /* ... */ int16_t;
17       typedef /* ... */ int32_t;
18       typedef /* ... */ int64_t;
19
20       typedef /* ... */ uint8_t;
21       typedef /* ... */ uint16_t;
22       typedef /* ... */ uint32_t;
23       typedef /* ... */ uint64_t;
24
25       #define INT8_WIDTH   8
26       #define INT16_WIDTH  16
27       #define INT32_WIDTH  32
28       #define INT64_WIDTH  64
29
30       #define UINT8_WIDTH  8
31       #define UINT16_WIDTH 16
32       #define UINT32_WIDTH 32
33       #define UINT64_WIDTH 64
34
35       #define INT8_MAX     /*  2**(INT8_WIDTH - 1) - 1   */
36       #define INT16_MAX    /*  2**(INT16_WIDTH - 1) - 1  */
37       #define INT32_MAX    /*  2**(INT32_WIDTH - 1) - 1  */
38       #define INT64_MAX    /*  2**(INT64_WIDTH - 1) - 1  */
39
40       #define INT8_MIN     /*  - 2**(INT8_WIDTH - 1)     */
41       #define INT16_MIN    /*  - 2**(INT16_WIDTH - 1)    */
42       #define INT32_MIN    /*  - 2**(INT32_WIDTH - 1)    */
43       #define INT64_MIN    /*  - 2**(INT64_WIDTH - 1)    */
44
45       #define UINT8_MAX    /*  2**INT8_WIDTH - 1         */
46       #define UINT16_MAX   /*  2**INT16_WIDTH - 1        */
47       #define UINT32_MAX   /*  2**INT32_WIDTH - 1        */
48       #define UINT64_MAX   /*  2**INT64_WIDTH - 1        */
49
50       #define INT8_C(c)    c ## /* ... */
51       #define INT16_C(c)   c ## /* ... */
52       #define INT32_C(c)   c ## /* ... */
53       #define INT64_C(c)   c ## /* ... */
54
55       #define UINT8_C(c)   c ## /* ... */
56       #define UINT16_C(c)  c ## /* ... */
57       #define UINT32_C(c)  c ## /* ... */
58       #define UINT64_C(c)  c ## /* ... */
59

DESCRIPTION

61       intN_t are signed integer types of a fixed width of exactly N  bits,  N
62       being  the  value  specified  in its type name.  They are be capable of
63       storing values in the range [INTN_MIN, INTN_MAX], substituting N by the
64       appropriate number.
65
66       uintN_t  are unsigned integer types of a fixed width of exactly N bits,
67       N being the value specified in its type  name.   They  are  capable  of
68       storing  values  in the range [0, UINTN_MAX], substituting N by the ap‐
69       propriate number.
70
71       According to POSIX, [u]int8_t, [u]int16_t, and [u]int32_t are required;
72       [u]int64_t  are  only  required in implementations that provide integer
73       types with width 64; and all other types of this form are optional.
74
75       The macros [U]INTN_WIDTH expand to the width in  bits  of  these  types
76       (N).
77
78       The macros [U]INTN_MAX expand to the maximum value that these types can
79       hold.
80
81       The macros INTN_MIN expand to the minimum value that  these  types  can
82       hold.
83
84       The  macros [U]INTN_C() expand their argument to an integer constant of
85       type [u]intN_t.
86
87       The length modifiers for the [u]intN_t types for the  printf(3)  family
88       of  functions  are expanded by macros of the forms PRIdN, PRIiN, PRIuN,
89       and PRIxN (defined in <inttypes.h>); resulting for example in %"PRId64"
90       or %"PRIi64" for printing int64_t values.  The length modifiers for the
91       [u]intN_t types for the scanf(3) family of functions  are  expanded  by
92       macros  of  the forms SCNdN, SCNiN, SCNuN, and SCNxN, (defined in <int‐
93       types.h>); resulting for example in %"SCNu8" or %"SCNx8"  for  scanning
94       uint8_t values.
95

STANDARDS

97       C11, POSIX.1-2008.
98

HISTORY

100       C99, POSIX.1-2001.
101
102       The [U]INTN_WIDTH macros were added in C23.
103

NOTES

105       The   following   header   also  provides  these  types:  <inttypes.h>.
106       <arpa/inet.h> also provides uint16_t and uint32_t.
107

SEE ALSO

109       intmax_t(3type), intptr_t(3type), printf(3)
110
111
112
113Linux man-pages 6.04              2023-03-30                     intN_t(3type)
Impressum