Data type are the means to identify the type of data &its associate operation for handling it. C++ provide a predefined set of data type for handling the data it use data type in c++ be classified under various categories.
Built in data type/Primary data type ->
Int, Float, Character, Double, long, void
User define data type ->
Struct, Union, Class, Enum
Compositive derived data type ->
Array, Function, Const, Pointer
Data Type
Signed Char | -128 to +127 | 1 | %c |
Unsigned Char | 0 to 255 | 1 | %c |
Short Signed Char | -32768 to +32767 | 2 | %d |
Short Unsigned Char | 0 to 65535 | 2 | %u |
Signed Int | -32768 to +32767 | 2 | %d |
Unsigned Int | 0 to 65535 | 2 | %u |
Long Signed Int | -2147483648 to +2147483647 | 4 | %ld |
Long Unsigned Int | 0 to 4294967295 | 4 | %lu |
Float | -3.4e38 to +3.4e38 | 4 | %f |
Double | -1.7e308 to +1.7e308 | 8 | %lf |
Long Double | -1.7e4932 to +1.7e4932 | 10 | %lf |
Void
It is a specific a empty set of value .It is used to return type of function they don’t
Return a value void means nothing.
Example of Data Type
#include<stdio.h>
#include<conio.h>
void main(){
unsigned i=-1;
clrscr();
printf(“%u”,i);
printf("%d",i);
getch();
}
Output
65535
-1
0 Comments