Skip to main content
The long long data type in C is a standard integer type introduced in the C99 specification that guarantees a minimum storage width of 64 bits. It provides the largest standard integer capacity available in the language, strictly adhering to the hierarchical type constraint that sizeof(long long) >= sizeof(long) >= sizeof(int).

Syntax and Declarations

The type can be declared as signed or unsigned. By default, omitting the sign specifier results in a signed integer.

Memory Footprint and Value Ranges

While the C standard dictates a minimum of 64 bits, on most modern architectures (both 32-bit and 64-bit systems), long long is exactly 64 bits (8 bytes). To accommodate ones’ complement and sign-magnitude architectures in C99 through C17, the standard guarantees the following minimum value ranges:
  • signed long long: (2631)-(2^{63}-1) to 26312^{63}-1
    • (-9,223,372,036,854,775,807 to 9,223,372,036,854,775,807)
    • Note: While C23 formally mandates two’s complement representation (extending the minimum to 263-2^{63}), the historical and strict C99 guaranteed minimum is (2631)-(2^{63}-1).
  • unsigned long long: 00 to 26412^{64}-1
    • (0 to 18,446,744,073,709,551,615)

Literal Suffixes

According to C standard rules for integer constants, an unsuffixed decimal literal automatically assumes the type long long int if its value cannot be represented by an int or long int. Suffixes are strictly required only when you want to explicitly force a smaller value to be typed as long long, or when you are writing an unsigned decimal constant that exceeds LLONG_MAX.

Format Specifiers

To perform standard I/O operations (such as printf and scanf) with long long variables, you must use the ll (double-ell) length modifier combined with the appropriate conversion specifier.

Standard Library Limits

The <limits.h> header provides preprocessor macros that define the exact boundary values for long long types on the target compilation platform.
Tired of Poor C Skills? Fix That With Deep Grasping!Learn More