---
title: 1.27 Basic C Type Limits
description: "C defines minimum ranges for its fundamental integer types. The exact size and range of a type can vary between implementations, so programs should not assume that a type always has a particular size. ``` #include #include int main() {…"
url: "https://edcret.in/docs/c-programming/basic-refreshers/1-27-basic-c-type-limits/"
updated: "2026-09-06"
category: C Programming / Basic Refreshers
---

# 1.27 Basic C Type Limits

C defines minimum ranges for its fundamental integer types. The exact size and range of a type can vary between implementations, so programs should not assume that a type always has a particular size.

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

int main()
{
    printf("CHAR_BIT  = %dn", CHAR_BIT);
    printf("CHAR_MIN  = %dn", CHAR_MIN);
    printf("CHAR_MAX  = %dn", CHAR_MAX);

    printf("INT_MIN   = %dn", INT_MIN);
    printf("INT_MAX   = %dn", INT_MAX);

    printf("LONG_MIN  = %ldn", LONG_MIN);
    printf("LONG_MAX  = %ldn", LONG_MAX);

    return 0;
}
```

### Example Output

On a typical implementation:

```
CHAR_BIT  = 8
CHAR_MIN  = -128
CHAR_MAX  = 127
INT_MIN   = -2147483648
INT_MAX   = 2147483647
LONG_MIN  = -9223372036854775808
LONG_MAX  = 9223372036854775807
```

### Explanation

The `<limits.h>` header provides macros describing implementation-defined limits for integer types.

| Macro | Describes |
| --- | --- |
| `CHAR_BIT` | Number of bits in a byte |
| `CHAR_MIN` | Minimum value of `char` |
| `CHAR_MAX` | Maximum value of `char` |
| `SCHAR_MIN` | Minimum value of `signed char` |
| `SCHAR_MAX` | Maximum value of `signed char` |
| `UCHAR_MAX` | Maximum value of `unsigned char` |
| `SHRT_MIN` | Minimum value of `short` |
| `SHRT_MAX` | Maximum value of `short` |
| `USHRT_MAX` | Maximum value of `unsigned short` |
| `INT_MIN` | Minimum value of `int` |
| `INT_MAX` | Maximum value of `int` |
| `UINT_MAX` | Maximum value of `unsigned int` |
| `LONG_MIN` | Minimum value of `long` |
| `LONG_MAX` | Maximum value of `long` |
| `ULONG_MAX` | Maximum value of `unsigned long` |
| `LLONG_MIN` | Minimum value of `long long` |
| `LLONG_MAX` | Maximum value of `long long` |
| `ULLONG_MAX` | Maximum value of `unsigned long long` |

For example:

```
printf("%dn", INT_MAX);
```

prints the largest value that an `int` can represent on the implementation.

The actual limits should be obtained from `<limits.h>` rather than assumed from a particular compiler or processor.
