On this page
  1. INT_MAX
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

INT_MAX

Prev: limits.h | Up: limits.h | Next: CHAR_BIT
Rel: limits.h, stdint, stdbool & limits Guide
Ref: cppreference — INT_MAX
Tags: #public #prog #c #stdlib #limits #tier/core


Include

#include <limits.h>

Signature & Overview

#define INT_MAX /* >= 32767; 2147483647 on 32-bit int */

Maximum (and INT_MIN minimum) representable values of int.

Notes & Pitfalls

Example

#include <assert.h>
#include <limits.h>

int main(void) {
    int a = INT_MAX - 5, b = 10;
    assert(a > INT_MAX - b); // safe overflow check
}

Linked from

Related notes