`int` — C Keyword

`int` — C Keyword

The int keyword in C: the natural signed integer type for the platform.

How to use this reference page

Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.

  • Scan the top of the page first to identify the primary types, functions, or algorithm families involved.
  • Use the nearby-page links when your question is really about a companion header, related algorithm family, or broader subsystem.
  • Validate tricky behavior with a small compileable example before relying on memory for details like invalidation, ordering, allocation, or lifetime rules.

int (C)

The natural signed integer type for the target platform. At least 16 bits; typically 32 bits on all modern 32/64-bit systems.

Syntax

int n;
int n = 42;
unsigned int u;
long int l;

Example

#include <stdio.h>
#include <limits.h>

int main(void) {
    int a = 10, b = 3;

    printf("%d\n", a + b);   /* 13 */
    printf("%d\n", a / b);   /* 3 (truncated) */
    printf("%d\n", a % b);   /* 1 */
    printf("INT_MAX: %d\n", INT_MAX);  /* 2147483647 on 32-bit int */
    return 0;
}

Notes

Example in practice

int main() {
    // Pick one facility from this reference page.
    // Write the smallest program that exercises its main precondition,
    // complexity rule, or lifetime constraint before scaling up.
    return 0;
}