Type support
From cppreference.com
< c
See also type system overview and arithmetic types defined by the language.
Basic types
Additional basic types and convenience macros
Defined in header
<stddef.h> | |
unsigned integer type returned by the sizeof operator (typedef) | |
signed integer type returned when subtracting two pointers (typedef) | |
implementation-defined null pointer constant (macro constant) | |
(C11) |
a type with alignment requirement as great as any other scalar type (typedef) |
byte offset from the beginning of a struct type to specified member (function macro) | |
Defined in header
<stdbool.h> | |
bool (C99)(until C23) |
convenience macro, expands to _Bool (keyword macro) |
true (C99)(until C23) |
expands to integer constant 1 (macro constant) |
false (C99)(until C23) |
expands to integer constant 0 (macro constant) |
__bool_true_false_are_defined (C99)(deprecated in C23) |
expands to integer constant 1 (macro constant) |
Defined in header
<stdalign.h> | |
alignas (C11)(until C23) |
convenience macro, expands to keyword _Alignas (keyword macro) |
alignof (C11)(until C23) |
convenience macro, expands to keyword _Alignof (keyword macro) |
__alignas_is_defined (C11)(until C23) |
expands to integer constant 1 (macro constant) |
__alignof_is_defined (C11)(until C23) |
expands to integer constant 1 (macro constant) |
Defined in header
<stdnoreturn.h> | |
noreturn (C11)(deprecated in C23) |
convenience macro, expands to _Noreturn (keyword macro) |
Fixed width integer types (since C99)
Numeric limits
Notes
The type of A program may undefine and perhaps then redefine the macros |
(since C99) (until C23) |
The type of If |
(since C23) |
Example
Run this code
Possible output:
0 1 1 0 2 2
References
- C17 standard (ISO/IEC 9899:2018):
- 7.15 Alignment <stdalign.h> (p: 196)
- 7.18 Boolean type and values <stdbool.h> (p: 210)
- 7.19 Common definitions <stddef.h> (p: 211)
- 7.23 _Noreturn <stdnoreturn.h> (p: 263)
- 7.31.9 Boolean type and values <stdbool.h> (p: 332)
- C11 standard (ISO/IEC 9899:2011):
- 7.15 Alignment <stdalign.h> (p: 268)
- 7.18 Boolean type and values <stdbool.h> (p: 287)
- 7.19 Common definitions <stddef.h> (p: 288)
- 7.23 _Noreturn <stdnoreturn.h> (p: 361)
- 7.31.9 Boolean type and values <stdbool.h> (p: 456)
- C99 standard (ISO/IEC 9899:1999):
- 7.18 Boolean type and values <stdbool.h> (p: 253)
- 7.19 Common definitions <stddef.h> (p: 254)
- 7.26.7 Boolean type and values <stdbool.h> (p: 401)
- C89/C90 standard (ISO/IEC 9899:1990):
- 4.1.5 Common definitions <stddef.h>