> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# C long long

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.

```c theme={"dark"}
long long var1;                   // Implicitly signed 64-bit integer
signed long long var2;            // Explicitly signed 64-bit integer
unsigned long long var3;          // Unsigned 64-bit 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`**: $-(2^{63}-1)$ to $2^{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 $-2^{63}$), the historical and strict C99 guaranteed minimum is $-(2^{63}-1)$.*
* **`unsigned long long`**: $0$ to $2^{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`.

```c theme={"dark"}
// Automatically typed as long long if it exceeds long capacity
long long auto_val = 9223372036854775807; 

// 'LL' or 'll' forces a smaller value to be signed long long
long long forced_signed = 42LL; 

// 'ULL', 'ull', 'Ull', or 'uLL' forces unsigned long long.
// Required for unsigned decimal literals > LLONG_MAX.
unsigned long long max_unsigned = 18446744073709551615ULL; 
```

## 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.

```c theme={"dark"}
long long s_val = -42LL;
unsigned long long u_val = 42ULL;

// Signed decimal
printf("%lld\n", s_val);  // or %lli

// Unsigned decimal
printf("%llu\n", u_val);

// Unsigned hexadecimal (lowercase / uppercase)
printf("%llx\n", u_val);
printf("%llX\n", u_val);

// Unsigned octal
printf("%llo\n", u_val);
```

## 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.

```c theme={"dark"}
#include <limits.h>
#include <stdio.h>

int main() {
    printf("Min signed: %lld\n", LLONG_MIN);
    printf("Max signed: %lld\n", LLONG_MAX);
    printf("Max unsigned: %llu\n", ULLONG_MAX);
    
    return 0;
}
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor C Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
