Datatypes in C++

What is a Datatype in C++?.
Basic Datatypes used in C++.

Explanation

The set of values along with the operations that can be performed on these values are categorized as datatypes. These data types are used to represent the memory usage in bytes, so appropriate a data type has to be used for optimum memory usage. Some data types have "unsigned", "signed" range.

Signed Range:


The signed range the values can either be positive or negative values.

Unsigned Range:


The unsigned range the values would represent positive values and zero.

The following table lists the different Datatypes used in C++.
Name Description Size(bytes) Range
char Character or small integer. 1 -128 to 127,
0 to 255
short int(short) Short Integer. 2 -32768 to 32767,
0 to 65535
int Integer. 4 -2147483648 to 2147483647,
0 to 4294967295
long int(long) Long integer 4 -2147483648 to 2147483647,
0 to 4294967295
bool Boolean value 1 true or false
float Floating point number. 4 +/- 3.4e to +/- 38 (~7 digits)
double Double precision floating point number. 8 +/- 1.7e to +/- 308 (~15 digits)
long double Long double precision floating point number. 8 +/- 1.7e to +/- 308 (~15 digits)
wchar_t Wide character. 2 or 4 1 wide character

The other data types include "String", "Array", "Pointer" datatypes.


The unsigned range the values would represent positive values and zero.

C++ Tutorial


Ask Questions

Ask Question