tags:

views:

143

answers:

2

what is the meaning of qualifier and difference between qualifier and keyword?

as Volatile qualifier in C and we can say volatile is keyword so waht is the meaning of qualifier?

A: 

Keywords are reserved words that have a special meaning in a programming language. You're not allowed to introduce a different meaning to them.

Now what particular keywords mean in a particular language is a different story.

In your case, volatile is a qualifier that will tell the compiler to treat a variable differently, namely by dropping certain optimizations.

Developer Art
+6  A: 

A qualifier modifies (qualifies - adds an extra "quality" to) what follows, such as specifying volatility or constness of a variable. It's like using an adjective: "a tired man", "a volatile int". With or without a qualifier, the variable itself still occupies the same amount of memory, each bit has the same interpretation or contribution to the state/value. Qualifiers just specify something about how it may be accessed or where it is stored.

keywords are any sequence of identifiers (textual characters, underscores, numbers) that the language itself assigns some meaning to, rather than leaving that word free for you to use for your own identifiers. So, volatile is both a qualifier and a keyword, while e.g. "if", "class" are keywords but not qualifiers. C++ doesn't currently have any qualifiers that aren't keywords (i.e. they're all "words" rather than some punctuation symbols).

Tony
Alexander Rafferty
Tony