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

SIZE_MAX

Prev: PRIu64 | Up: stdint.h | Next: stddef.h
Rel: stdint.h, stdint, stdbool & limits Guide
Ref: cppreference — SIZE_MAX
Tags: #public #prog #c #stdlib #stdint #tier/standard


Include

#include <stdint.h>

Signature & Overview

#define SIZE_MAX /* max value of size_t */

Maximum representable value of size_t, used for overflow checks before multiplication.

Notes & Pitfalls

Example

#include <assert.h>
#include <stdint.h>

int main(void) {
    size_t n = 1000;
    assert(n <= SIZE_MAX / sizeof(int));
}

Linked from

Related notes