Type Modifiers in C Language: signed, unsigned, long & short
December 29, 2009
Data Type Modifiers/Qualifiers in C Language
In the previous tutorial we discussed about the primary data types in C Language. In addition, these data types have some modifiers preceding them. The use of these modifiers changes the meaning of the base type.
The memory in the computer is organized in terms of units called bytes. One byte consists of 8 bits and bit is a smallest unit of memory.
Need of Data Modifiers:
Let us take an example of a Program where we need to input the “Salary” of “Employees” in a team. This program will accept the salary as an input from user and then calculate the Income Tax of that user. We use “int” to store the Salary of the employee as we are assuming that the salary will be in “Whole Numbers”.
An integer data type takes 2 Bytes of Memory and we are aware that the Salary of any of the employee can not be “Negative”. We are using “2 Bytes” to store the memory of an Employee and we can easily save 1 Byte over there by removing the “Signed Part” in the integer. This positive value can easily be stored in “1 Bye Int” This leads us to the user of Data Type Modifiers. WAIT! There is more to read… read on »