Modifiers
Modifiers are the keywords used to modify the properties of data type.
Modifiers are short, long, signed, unsigned.

Below is the list of all possible combination of use of modifiers with data type:

For Integers
int, short int, signed int, long int, unsigned int, unsigned short int, unsigned long int, unsigned long long int, long long int.

For real constants
float, double, long double, long long double

For character constants
char, unsigned char

Modification in the properties of data type due to the use of modifiers varies with the architecture. For example in 16 bit compilers int variable consumes 2 bytes and long int variable takes 4 bytes in the memory. While in 32-bit/64-bit compilers int usually takes 4 bytes in memory and long int also consumes 4 bytes. We present here a tabular information about the changes happened in the properties of data type due to the use of modifiers under 32-bit/64-bit system.

Type Size Format Specifier Content allowed Range
char 1 byte %c Character -128 to 127
unsigned char 1 byte %c Character 0 to 255
int 4 byte %d Integer -2,147,483,648 to 2,147,483,647
unsigned int 4 byte %u Integer 0 to 4,294,967,295
short int 2 byte %hd Integer -32,768 to 32,767
unsigned short int 2 byte %hu Integer 0 to 65,535
long int 4 byte %ld Integer -2,147,483,648 to 2,147,483,647
unsigned long int 4 byte %lu Integer 0 to 4,294,967,295
long long int 8 byte %lld Integer −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long long int 8 byte %llu Integer 0 to 18,446,744,073,709,551,615
float 4 byte %f Real 1.1754*(10^-38) to 3.4028* (10^+38)
double 8 byte %lf Real 2.2250 * (10^-308) to 1.7976 * (10^+308)
long double 12 byte %Lf Real 3.4 * (10^-4932) to 1.1 * (10^4932)

Remember
int and signed int are same, that is writing signed is redundant. Similarly, following have the identical meanings:

long long is same as long long int
signed long int is same as long int
signed char is same as char

You can not use signed or unsigned and short modifier with float and double.

Modifiers

One thought on “Modifiers

Comments are closed.