Horizontal Nav

Tuesday 18 August 2015

Basic 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 types:

          i)          int                    Integer
            ii)         float                Floating Point
            iii)        double            Double Precision
            iv)        char                Characters
            v)         bool                Boolean



Floating Point Data Type

The float represents real or floating type data. The real type data is represented in decimal or exponential notation. The storage capacity for float type variable is four byte.

For Example:

            float var_name;

Integer Data Type

The int represents the integer data. It is used to declare integer type variable. An integer is a whole number i.e. a number without a fraction or a decimal point. The storage capacity for integer type variable is two bytes.

For Example:

            int var_name;

Character 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 characters can be stored. The storage capacity for character type variable is one bytes.

For Example:

            char var_name;

No comments:

Post a Comment