
C Programming Modifier
Table of Contents
Modifiers create new data types by changing the meaning of the basic data type.
C Size Modifier
Size modifiers can change the size of basic data types. There are two types of size modifiers in C programming:
- short
- long
Below is an example of a size modifier:
long double i;
The size of double is 8 bytes. If you use the long keyword with this, the size of the variable becomes 10 bytes.
If you feel that the value of the variable does not need to be very large you can use the short keyword. For example:
short int a; //Occupies 2 bytes of memory space for all operating systems
C sign Modifier
Both integer and floating point variables can take positive and negative values. However, if the value of the variable is to be positive only then unsigned data type should be used.
// unsigned variables cannot have negative values
unsigned int positiveInteger;
There is also another modifier signed which can have both positive and negative values. But there is no need to define it because the variable is signed by default.
An integer variable of 4 bytes can have value from -2 31 to 2 31 -1. But if the variable is defined as unsigned, it can have value from 0 to 2 32 -1.
Remember, the sign modifier only applies to int and char data types.

C Constant Modifier
Identifiers can also be declared as constants. The const keyword is used for this.
const int age = 32;
The value of the age variable will not change in the program.
C Volatile modifier
To change the value of a variable through an external source outside the program, the variable should be declared as volatile.
Pingback: C print() and scanf() Functions -