Qualifiers or modifier in C Programming

Pankaj Jaiswal
3 min readMar 3, 2021

Qualifier:It is used to modify the basic(primitive) data type in C.We can say that,this are the keyword which is used to modify the properties of variable.

Types of qualifiers In C:

1.Size Qualifier:Size Qualifier is used to change the size of the basic data type.By default the size of the integer data type is of 2 byte,In some cases we may require to increase or decrease the size of variable of type int or any other type In such case,we can use Size Qualifier.

  • Short:It reduces the size of the basic data type or keep the size as it is based on compiler,for eg if we use short qualifier in Turbo C++ Compiler then short is of 2 byte and In Linux compiler short is of 1 byte We use it, when we know that the value we are storing is of small range,Hence to make memory become more efficient then we can use short Size qualifier.

Syntax for short qualifier:

short data_type variable_name;

Eg:short int a;

  • Long:It increases the size of the basic data type.If you want to store greater range of value i.e range is above the range of basic int or any other data type then we can use long Size qualifier.

Syntax for long qualifier:

long data_type variable_name;

Eg:long int a;

2.Sign Qualifier:Sign qualifier in C is used to specify signed nature of integer types.It tells us whether a variable can hold a negative value or not.It can be used with int and char data type variable.

Types of Sign Qualifier:

  • Signed:The name itself specifies there is sign before corresponding value.It can be either Negative value or Positive value.So,we Can say that Signed Qualifier can store both negative and positive value.

Syntax for Signed Qualifier:

signed data_type variable_name;

Eg: signed int i;

In above eg,we can store both positive and negative value in i.

  • Unsigned:As the name indicate there is no sign before the corresponding value so by default the sign will we be Positive(+ve).So,we Can say that Unsigned Qualifier can store only positive value.

Syntax for Unsigned Qualifier:

unsigned data_type variable_name;

Eg: unsigned int r;

In above eg,we can store only positive value in r.

3.Const Qualifier:Const refer to Constant.Const Qualifier are nothing but constant value which are assigned to the variable which does not change through the execution of the program. If try to change the const variable then compiler will throw an error.The initilization of const variable should be done during declaration only otherwise compiler will throw an error.We use const variable when we known that value of particular variable will not change for eg the value of Pi in Mathematics remain constant i.e 3.14.

Syntax for Const Qualifier:

const data_type variable_name=value;

Eg: const float pi=3.14;

4.Volatile Qualifier:C’s volatile keyword is a qualifier that is applied to a variable when it is declared. It tells the compiler that the value of the variable may change at any time — without any action being taken by the code the compiler finds nearby.

C Programming Course from Scratch:https://bit.ly/3rd8eq2

--

--