Difference between Keyword and Identifier

Keyword Vs. Identifier: Explore the difference between Keyword and Identifier

In the world of programming languages, keywords and identifiers are important terminologies. Some programming languages contain keywords and identifiers that are recognized by its compiler. In general, keywords are the predefined and specific reserved words, which hold special meaning. On the other hand, an identifier is a different term or name given to a variable, label of class in the program or function. Let’s find out the difference between keywords and identifiers.

What is a Keyword?

Keywords are the predefined and specific reserved words, which hold special meaning. Keywords help in defining any statement in the program. When it comes to C language it consists of 32 keywords. Some of the examples of keywords are: double, int, auto, char, break, and more.

What is an Identifier?

A particular name generated by the programmer to define a variable, structure, class, or function is called an identifier. It is important to suggest some understandable names to the identifiers to get the code quickly readable.

Difference between Keyword and Identifier

S.No.

Keyword

Identifier

1

Keywords are predefined and specific reserved words, which hold special meaning. Keywords help in defining any statement in the program.

A particular name generated by the programmer to define a variable, structure, class, or function is called an identifier.

2

A keyword begins with lowercase.

In the identifier, the first character may begin with uppercase, lowercase or underscores.

3

It defines the type of entity.

It classifies the name of the entity.

4

It can only have alphabetical characters.

It can have numbers, alphabetical characters, and underscores.

5

It should be lowercase.

It can be both upper and lowercase.

6

It helps in defining a particular property that subsists in a computer language.

It helps in locating the name of the entity.

7

double, int, auto, char, break, and more are examples of keywords.

Test, count1, high_speed, etc are examples of identifiers.

Keep learning and stay tuned to get the latest updates on the GATE Exam along with GATE Preparation Books & GATE Answer Key and more.

Leave a Comment

Your Mobile number and Email id will not be published.

*

*