Tuesday, 3 January 2012

Int-Data Type

C provides several standard integer types.
Each type can be signed or unsigned. 
Signed types can represent positive and negative numbers while unsigned can represent zero and positive numbers. 
C defines a minimum set of characters that need to be supported on a system where C programs are written and run.
Each character is given a numeric value such as A = 65, B = 66, etc. 
A char is an integer number big enough to at least hold the maximum value in this set, though in typical implementations it is bigger. 
C does not specify whether a plain 'char' refers to a signed or unsigned number - that is implementation defined. 
If you need to be sure your char variable is signed or unsigned, specify it in the declaration like this: unsigned char c.
The short int is a signed small integer. 
C allows abbreviated or longer names for the same type: short, signed short, signed short int. 
For the unsigned version use one of these: unsigned short, unsigned short int.
A signed integer may be declared as: int, signed, signed int. 
An unsigned integer may be declared as: unsigned, unsigned int.
A signed long int may be declared using one of these names: long, signed long, ,long int, signed long int. 
An unsigned version may be declared as: unsigned long, unsigned long int.
A signed long long can be declared like this: long long, singed long long, long long int, signed long long int. 
An unsigned can be declared as: unsigned long long, unsigned long long int.
Type
Minimum Value
Maximum Value
signed char
-127
127
unsigned char
0
255
short
-32767
32767
unsigned short
0
65535
int
-32767
32767
unsigned int
0
65535
long
-2147483647
2147483647
unsigned long
0
4294967295
signed long long
-9223372036854775807
9223372036854775807
unsigned long long
0
18446744073709551615


No comments:

Post a Comment

host gator coupon