You are not logged in. Please login at www.codechef.com to post your questions!

×

The old forum can be viewed here. Seek help.

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 ?

asked 28 Mar '13, 10:37

skarthick's gravatar image

skarthick
745711
accept rate: 0%

edited 28 Mar '13, 17:54


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.
link
This answer is marked "community wiki".

answered 28 Mar '13, 18:49

ajay154's gravatar image

ajay154
1.5k42043
accept rate: 8%

Nice one.Thank you so much...:-)

(28 Mar '13, 21:39) skarthick
link

answered 28 Mar '13, 18:02

piyukr's gravatar image

piyukr
564612
accept rate: 0%

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

(28 Mar '13, 18:03) piyukr

Thanks....:-)

(28 Mar '13, 18:43) skarthick
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×11

Asked: 28 Mar '13, 10:37

Seen: 2,114 times

Last updated: 28 Mar '13, 21:39