Saturday, March 7, 2015

Data types in C++

Data types in C++:

                The variable type specifies the type of data that can be stored in it. Each variable  is declared by its  type.
C++ has five basic data type. These are
int                          Integer
float                       Floating point
double                   Double precision
char                       Characters
bool                       Boolean

First five data type are also available in C language. The bool is data type a new addition in C++.

The int data type:
                                  This data type is used to declare integer data type variable. An integer is whole number .the storage capacity of int type variable can be changed by applying the   integer qualifiers. There are three qualifiers that can be applied to int data type variables. These are
Short int(storage capacity  is 2 byte)
Long int (storage capacity is 4 byte)
Unsigned int(storage capacity is 2 byte and store only positive whole number)

Float data type:
                                       Float represents real or floating type data. The real data type is represented in decimal or exponential notation it may be signed or unsigned and its storage capacity is 4 byte.

Char data type:
                                      The char stands for character. It is used to declare character type variable. In character type variable, alphabetic characters, numeric digits and special charters can be stored.

Bool data type:
                         The word bool stand for Boolean. It is used to declare logical type variables. In logical type variable only two values true or false can be stored. True is equivalent to 1 and false to 0.



Data Types Characteristics 
              

0 comments:

Post a Comment