CPP

Basic Data Types

Data types in c++ can be classified under various categories as shown in figure.


basic datatypes
 
  • Both C and C++ compilers support all the built-in data types.
  • The basic data types may have several modifiers preceding them to serve the needs of various situations.
  • The modifiers signed, unsigned, modifier long may also be applied to double.
  • The void have no preciding modifires.
  • Data type representation is machine specific in C++.
Data Type Size Range
char 1 byte -127 to 127 or 0 to 255
unsigned char 1 byte 0 to 255
signed char 1 byte -127 to 127
int 4 byte -2147483648 to 2147483647
unsigned int 4 bytes 0 to 4294967295
signed int 4 bytes -2147483648 to 2147483647
short int 2 bytes  -32768 to 32767
unsigned short int Range 0 to 65,535
signed short int Range -32768 to 32767
long int 4 bytes -2,147,483,648 to 2,147,483,647
signed long int 4 bytes Same as long int
unsigned long int 4 bytes 0 to 4,294,967,295
float 4 bytes +/- 3.4e +/- 38    7digits
double 8 bytes +/- 1.7e +/- 308   15digits
long double 8 bytes +/- 1.7e +/- 308   15digits
wchar_t 2 or 4 bytes 1 wide character



Subscribe us on Youtube

Share This Page on


Ask Question