what is the range of signed integer ?

What is the range of signed int ,signed long int,signed long long int in gcc ?
Also if possible pl tell me the format specifiers also ?

this could help:

2 Likes

signed char
The 8-bit signed char data type can hold integer values in the range of −128 to 127.

unsigned char
The 8-bit unsigned char data type can hold integer values in the range of 0 to 255.

    
char
Depending on your system, the char data type is defined as having the same range as either the signed char or the unsigned char data type (they are three distinct types, however). By convention, you should use the char data type specifically for storing ASCII characters (such as `m'), including escape sequences (such as `\n').

    
short int
The 16-bit short int data type can hold integer values in the range of −32,768 to 32,767. You may also refer to this data type as short, signed short int, or signed short.

    
unsigned short int
The 16-bit unsigned short int data type can hold integer values in the range of 0 to 65,535. You may also refer to this data type as unsigned short.

    
int
The 32-bit int data type can hold integer values in the range of −2,147,483,648 to 2,147,483,647. You may also refer to this data type as signed int or signed.

    
unsigned int
The 32-bit unsigned int data type can hold integer values in the range of 0 to 4,294,967,295. You may also refer to this data type simply as unsigned.

    
long int
The 32-bit long int data type can hold integer values in the range of at least −2,147,483,648 to 2,147,483,647. (Depending on your system, this data type might be 64-bit, in which case its range is identical to that of the long long int data type.) You may also refer to this data type as long, signed long int, or signed long.

    
unsigned long int
The 32-bit unsigned long int data type can hold integer values in the range of at least 0 to 4,294,967,295. (Depending on your system, this data type might be 64-bit, in which case its range is identical to that of the unsigned long long int data type.) You may also refer to this data type as unsigned long.

    
long long int
The 64-bit long long int data type can hold integer values in the range of −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. You may also refer to this data type as long long, signed long long int or signed long long. This type is not part of C89, but is both part of C99 and a GNU C extension.



unsigned long long int
The 64-bit unsigned long long int data type can hold integer values in the range of at least 0 to 18,446,744,073,709,551,615. You may also refer to this data type as unsigned long long. This type is not part of C89, but is both part of C99 and a GNU C extension.
4 Likes

Do note the range depends on the bit-size of your compiler

Thanks…:slight_smile:

Nice one.Thank you so much…:slight_smile: