Differentiate Keyword and Identifier

Q1. What is the difference between a keyword and identifier?

Ans. Keyword is special word that has a special meaning and purpose. Keywords are reserved and are a few.

For example, goto, switch, else etc. are keywords.

Identifier  is the use-defined name given to a part of a program viz. variable, object, function etc. Identifiers are not reserved. These are defined by user but they can have letters, digits and a symbol underscore. They must begin with either a letter or underscore.

For instance, _chk, chess, trial etc. are identifiers in C++.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: