- C – type qualifiers : The keywords which are used to modify the properties of a variable are called type qualifiers.
Types of qualifiers in C Language:
There are two types of qualifiers available in C language. They are,
- const
- volatile
1. const keyword:
- Constants are also like normal variables. But, only difference is, their values can’t be modified by the program once they are defined.
- They refer to fixed values. They are also called as literals.
- They may be belonging to any of the data type.
- Syntax:
const data_type variable_name; (or) const data_type *variable_name;
- Please refer C – Constants topic in this tutorial for more details on const keyword.
2. volatile keyword:
- When a variable is defined as volatile, the program may not change the value of the variable explicitly.
- But, these variable values might keep on changing without any explicit assignment by the program. These types of qualifiers are called volatile.
- For example, if global variable’s address is passed to clock routine of the operating system to store the system time, the value in this address keep on changing without any assignment by the program. These variables are named as volatile variable.
- Syntax:
volatile data_type variable_name; (or) volatile data_type *variable_name;
……www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community
No comments:
Post a Comment