DATA TYPES IN C++:
The variable type specifies the type of the data that can be stored in it.
Each variable is declared by its types.
c++ have five basic data types.These data type are:
The storage capacity for a double type variable is 8 bytes and it can store real values.
The variable type specifies the type of the data that can be stored in it.
Each variable is declared by its types.
c++ have five basic data types.These data type are:
- int Integer
- float Floating point
- double Double Precision
- char Characters
- bool Boolean
The first four data types are also available in c language.The bool is data type a new addition in c++
THE int DATA TYPE:
the int represents the integer data.It is used to declare integer type variables.
An integer is a whole number,i.e a number without a fraction or a decimal point.For example,645,230,-8 and 501 are integers.
The range of values that can be stored int int data type variables depends upon the computer style being used.In MS DOS, an integer type variable takes two bytes in the memory and the range of values stored is from -32765 to 32765.
The storage capacity for integer type variable can be changed by applying the integer qualifiers.There are three qualifiers that can be applied to int type variables.These are:
- short int
- long int
- unsigned int
SHORT int:
The storage capacity of a short int type variable is two bytes.It can store integer values from -32458 to 32458.
LONG int:
The storage capacity of a long int type variable is four bytes.It can store integer values from -2147483648 to .2147483647.
UNSIGNED int:
The unsigned int can store only positive whole-numbers,It storage capacity is two bytes.It can store integer values from 0 to 65,535.
FLOAT DATA TYPE:
The float represents real to floating type data. The storage capacity for float type variable is four bytes The real type data represented in decimal or exponential notation.Float type data may be signed or unsigned.For example,23.34,0.34,-12.8 are example of floating type data.
LONG float DATA TYPE:
The storage capacity of a long float type variable is twice the storage capacity of float type variable. its storage capacity is 8 bytes.
double DATA TYPE:
The double is real or floating type data, its storage capacity is twice the capacity of flaot data type.It is used to store large real values.
The storage capacity for a double type variable is 8 bytes and it can store real values.
LONG double DATA TYPE:
The long double typr variable are used to store very large real data values.The storage capacity for long double variables is ten bytes A long double variable cn store real values.
char DATA TYPE:
The char stands for character.It is used to declare character type variables.
In character type variables.alphabetic character,numeric and special characters can be stored.The storage capacity for a single character in 8 bit or one byte.A char type variable can hold from 1 byte to 65535 bytes.
Arithmetic operations can also be performed one char type variables.
bool DATA TYPE:
The word bool stands for booleam.It is used to declare logical type variables.
In a logical type variable,only two values true or false can b stored. The true values is equivalent to 1 and false to 0.
dgreat explain
ReplyDeletethank u
Delete