What is Data Types
DATA TYPES
DATA TYPE defines a set of values that a variable can store along with a set of operations that can be performed on that variable. Common data types are integer, character, and real.
Types of Data Types
There are five main data types in C and these are char,int,float,double, and void (character, integer, floating-point, double floating-point, and valueless) respectively. All other data types in C are based upon one of these Data Types. The size and range of these data types may vary between processor types and compilers. However, in all cases a character is 1 byte. The size of an integer is usually the same as the word length of the execution environment of the program. For most 16-bit environments, such as DOS or Windows 3.1, an integer is 16 bits. For most 32-bit environments, such as
Windows NT, an integer is 32 bits. However, you cannot make assumptions about the size of an integer if you want your programs to be portable to the widest range of environments.
Values of type char are generally used to hold values defined by the ASCII character set. Values outside that range may be handled differently by different compilers. The range of float and double will depend upon the method used to represent the floating-point numbers. Whatever the method, the range is quite large. Standard C specifies that the minimum range for a floating-point value is 1E – 37 to 1E+37.
Type Typical Size in Bits Minimal Range
2,147,483,647
| char 8 | -127 to 127 |
| unsigned char 8 0 to 255 signed char 8 |
-127 to 127 |
| int 16 or 32 | -32,767 to 32,767 |
| unsigned int 16 or 32 0 to 65,535 | |
| signed int 16 or 32 same as | int |
| short int 16 | -32,767 to 32,767 |
| unsigned short int 16 0 to 65,535 | |
| signed short int 16 same as | short int |
| long int 32 | -2,147,483,647 to |
| signed long int 32 same as | long int |
| unsigned long int 32 0 to 4,294,967,295 | |
| float 32 Six digits of precision | |
| double 64 Ten digits of precision | |
| long double 80 Ten digits of precision |
The type void either explicitly declares a function as returning no value or creates generic pointers.
Modifying the Basic Types
Except for type void, the basic data types may have various modifiers preceding them. You use a modifier to alter the meaning of the base type to fit various situations more precisely. The list of modifiers is shown here:
signed
unsigned
long
short
Popularity: 1% [?]
Posted on December 13, 2009 at 8:01 am
woww……thats truly wonderful article on Data Types.