On this page
int
Prev: char | Up: builtins | Next: nullptr
Rel: stdint.h
Ref: cppreference — int
Tags: #public #prog #c #builtins #tier/core
Availability
Built-in (Built-in Type) — requires no #include header.
Syntax & Overview
int | unsigned int
Natural signed integer type (at least 16 bits, 32 bits on modern LP64/LLP64 systems).
Notes & Pitfalls
- Signed integer overflow is Undefined Behavior: For fixed bit widths or wraparound arithmetic, use
<stdint.h>(int32_t,uint32_t,uint64_t).
Example
#include <assert.h>
#include <limits.h>
int main(void) {
int x = 42;
assert(x <= INT_MAX);
}
Linked from
Related notes
- tuts/c/builtins/char Linked here; links to this page; shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/nullptr Linked here; links to this page; shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins Linked here; links to this page; shared tags: #builtins, #c, #prog
- tuts/c/stdlib/stdint Linked here; shared tags: #c, #prog
- tuts/c/builtins/__FILE__ shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/__func__ shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/__LINE__ shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/__STDC_VERSION__ shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/_Alignof shared tags: #builtins, #c, #prog, #tier
- tuts/c/builtins/_Atomic shared tags: #builtins, #c, #prog, #tier