`short` — C Keyword

`short` — C Keyword

The short keyword in C: a signed integer type at least 16 bits wide.

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.

short (C)

Shorthand for short int. A signed integer type at least 16 bits wide, typically exactly 16 bits on all modern platforms.

Syntax

short s;
short int s;
unsigned short us;

Example

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

int main(void) {
    short s = 1000;
    unsigned short us = 60000u;

    printf("short: %d\n", s);
    printf("unsigned short: %u\n", us);
    printf("SHRT_MAX: %d\n", SHRT_MAX);   /* 32767 */
    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;
}