C language is rich in its data type.
Data type tells the type of data, that you are going to store in memory.
It gives the information to compiler that how much memory ( No. of bytes ) will be stored by the data.
I. Primitive Data Types :
|char||1 byte||Used for characters or integer variables.|
|int||2 or 4 bytes||Used for integer values.|
|float||4 bytes||Single precision floating point values.|
|double||8 bytes||Double precision floating point values.|
In addition to these data types, some of them may be used with a modifier that affects the characteristics of the data object. These modifiers are listed in Table.
|long||Forces a type int to be 4 bytes (32 bits) long and forces a type double to be larger than a double (but the actual size is implementation defined). Cannot be used with short.|
|short||Forces a type int to be 2 bytes (16 bits) long. Cannot be used with long.|
|unsigned||Causes the compiler (and CPU) to treat the number as containing only positive values. Because a 16-bit signed integer can hold values between – 32,768 and 32,767, an unsigned integer can hold values between 0 and 65,535. The unsigned modifier can be used with char, long, and short (integer) types.|
The essence of all the data types that we have learnt so far has been captured in Table.
|Data Type||Range||Bytes||Format Specifier|
|signed char||-128 to +127||1||%c|
|unsigned char||0 to 255||1||%c|
|short signed int||-32768 to +32767||2||%d|
|short unsigned int||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|
NOTE : The sizes and ranges of int, short and long are compiler dependent.Sizes in above table are for 16-bit compiler.
II. Derived Data Types :
III. User Defined Data Types :
- 1. Enum view details...
- 2. Structure view details...
- 3. Union view details...
- 4. Typedef view details...
Training For College Campus
We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.
Please mail your requirement at email@example.com
Projects For Students
Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.
Students can mail requirement at firstname.lastname@example.org