Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
C++ Tutorial
C++ Language Tutorial - Object Oriented Programing - OOPs History of C++
C++ Language Tutorial - Object Oriented Programing - OOPs Structure of C++
C++ Language Tutorial - Object Oriented Programing - OOPs C++ Datatypes
C++ Language Tutorial - Object Oriented Programing - OOPs Variables
C++ Language Tutorial - Object Oriented Programing - OOPs Constants
C++ Language Tutorial - Object Oriented Programing - OOPs Operators
C++ Language Tutorial - Object Oriented Programing - OOPs Control Structures
C++ Language Tutorial - Object Oriented Programing - OOPs Arrays
C++ Language Tutorial - Object Oriented Programing - OOPs Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Class
C++ Language Tutorial - Object Oriented Programing - OOPs Predefined Functions
C++ Language Tutorial - Object Oriented Programing - OOPs I/O Functions
C++ Language Tutorial - Object Oriented Programing - OOPs String, Character Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Mathematical Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Time Date Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Dynamic Allocation
C++ Language Tutorial - Object Oriented Programing - OOPs Utility Functions
C++ Language Tutorial - Object Oriented Programing - OOPs OOP's Concept
C++ Language Tutorial - Object Oriented Programing - OOPs Special Topics
C++ Language Tutorial - Object Oriented Programing - OOPs Type casting
C++ Language Tutorial - Object Oriented Programing - OOPs Feedback
C++ Language Tutorial - Object Oriented Programing - OOPs Ask Your Doubts
 




Datatypes in C++


Tutorials Cpp

Topic

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.



Structure of a C++ program c++ char data type







Note
C++ is one of the most used programming languages in the world. Also known as "C with Classes". Hope you enjoy this tutorial. Do send your feedback or suggestions on this C++ tutorial. This is a copyright content.

Other Links

web hosting