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.
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;friends.
Hello !, I love your article so much! We look forward to another match
ReplyDeleteYour article on AOL? I need a specialist in this field to solve my problem.
Maybe you are! Looking forward to seeing you.
Read this: What is Printer
Dynamics 365 Partner, AlphaBOLD is a top Microsoft dynamics 365 partner that works on Microsoft Dynamics Sales & more. Choose the right Microsoft Dynamics 365 Consulting Providers in San Diego.
ReplyDelete