Data Type Modifiers, C++

In previous post Data Types in C++ we know the various data types using in C++. Now let see how can modify these data types. Int, char, float, double data types can be preceded with these modifiers to alter the meaning of the base type to fit various situation properly and expand them to a much larger set. There are four data type modifiers in C++, they are following.

  1. long
  2. short
  3. signed 
  4. unsigned 
Every data type has a limit for the largest and smallest value that it can store. This is known as the range. An integer can store any value ranging from -2147483648 to 2147483647. Data type modifiers usually alter the upper and lower limit of a data type. Unsigned modifiers makes a variable only to store positive values. 

Size and Range of C++ Data Types 

TYPE
SIZE(Bytes)
RANGE
char
1
-128 to 127
unsigned char
1
0 to 255
signed char
1
-128 to 127
int
2
-32768 to 32767
unsigned int
2
0 to 65535
signed int
2
-32768 to 32767
short int
2
-32768 to 32767
unsigned short int
2
0 to 65535
signed short int
4
-32768 to 32767
long int
4
-2147483648 to 2147483647
unsigned long int
4
0 to 4294967295
signed long int
4
-2147483648 to 2147483647
float
4
3.4E-38 to 3.4E+38
double
8
E-7E-308 to 1.7E+308
long double
10
3.4E-4932 to 1.1E+4932

0 comentários:

Post a Comment

POPULAR THIS MONTH

Blog Archive

Don't You Think this Awesome Post should be shared ??
| Data Type Modifiers, C++ |