The standard signed integer types and standard unsigned integer types are collectively called the standard integer types, the extended signed integer types and extended unsigned integer types are collectively called the extended integer types.

- short int
- int
- long int
- long long int

- unsigned short int
- unsigned int
- unsigned long int
- unsigned long long int

- short int
- int
- long int
- long long int
- unsigned short int
- unsigned int
- unsigned long int
- unsigned long long int

## Extended Integer types

N1988 proposes a new category of integer types called extended integer types. Here, “extended” means “nonstandard” rather than “types that are necessarily bigger than the standard types”. The extended integral types could thus be bigger than the largest standard type, or have a size between two standard types. Two common examples are 128-bit integers that some processors already support, and the 48-bit integers that can be found in some embedded systems and math packages.

## Conversion rank

For any two integer types with the same signedness and different integer conversion rank (see 6.3.1.1), the range of values of the type with smaller integer conversion rank is a subrange of the values of the other type.

- long long int, unsigned long long int
- long int, unsigned long int
- unsigned int, int
- unsigned short, short
- char, unsigned char, signed char
- _Bool

## Modulo Operators – Overflow

The range of non-negative values of a signed integer type is a subrange of the corresponding unsigned integer type, and the representation of the same value in each type is the same. A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type.

#include<stdio.h> int main(int argc, char* argv[]){ unsigned short int num1 = 65534; unsigned int good_num1 = 65534; printf("\nSize of num1 \t\t=\t %d bytes", sizeof(num1)); printf("\nSize of good_num1 \t=\t %d bytes", sizeof(good_num1)); printf("\n\nTrue value(good_num1)\t\t value stored in num1"); for(int i=0; i<10; i++){ printf("\n%d\t\t\t\t\t%d", good_num1, num1); num1++; good_num1++; } return 0; }

Size of good_num1 = 4 bytes

True value(good_num1) value stored in num1

65534 65534

65535 65535

65536 0

65537 1

65538 2

65539 3

65540 4

65541 5

65542 6

65543 7

#include<stdio.h> int main(int argc, char* argv[]){ short int num1 = 32766; int good_num1 = 32766; printf("\nSize of num1 \t\t = %d bytes", sizeof(num1)); printf("\nSize of good_num1 \t = %d bytes", sizeof(good_num1)); for(int i=0;i<10;i++){ printf("\n%d\t\t\t%d", good_num1, num1); num1++; good_num1++; } return 0; }

Size of good_num1 = 4 bytes

32766 32766

32767 32767

32768 -32768

32769 -32767

32770 -32766

32771 -32765

32772 -32764

32773 -32763

32774 -32762

32775 -32761