Data Types in C Language
Data Types in C Language
com
Page No. 1
C has different data types for different types of data and can be broadly classified as: 1. 2. Primary Data Types Secondary Data Types
www.eazynotes.com
Page No. 2
To control the range of numbers and storage space, C has three classes of integer storage namely short int, int and long int. All three data types have signed and unsigned forms. A short int requires half the amount of storage than normal integer. Unlike signed integer, unsigned integers are always positive and use all the bits for the magnitude of the number. Therefore, the range of an unsigned integer will be from 0 to 65535. The long integers are used to declare a longer range of values and it occupies 4 bytes of storage space.
Syntax: int <variable name>; int num1; short int num2; long int num3;
Example:
5, 6, 100, 2500.
www.eazynotes.com
Page No. 3
but with longer precision and takes double space (8 bytes) than float. To extend the precision further we can use long double which occupies 10 bytes of memory space.
Syntax: float <variable name>; float num1; double num2; long double num3;
Example:
9.125, 3.1254.
Example:
a, b, g, S, j.
www.eazynotes.com
Page No. 4
Void Type:
The void type has no values therefore we cannot declare it as variable as we did in case of integer and float. The void data type is usually used with function to specify its type.