Difference Between Keywords and Identifiers

By Anjnee Bhatnagar|Updated : October 6th, 2022

According to the C paradigm, major differences exist between keywords and identifiers. A keyword in C has a predefined meaning, while an identifier is just a name assigned by the user or programmer to a memory, function, or constant value.

Difference Between Keywords and Identifiers PDF

In C programming, keywords and identifiers play an important role as they are the basic building blocks of the language. We will explore the differences between keywords and identifiers in this article, along with individually discussing keywords and identifiers in brief.

Download Complete Computer Networks Formula Notes PDF

Difference Between Keywords and Identifiers

The main difference between keywords and identifiers is that a keyword can contain only the alphabet, whereas an identifier can contain alphabets, digits, and underscores. The differences between the two are essential parts of the GATE CSE syllabus.

Key Differences Between Keywords and Identifiers

Keyword

Identifier

It should always be in lowercase.

It can be in lower case or upper case.

It has a predefined meaning. They are reserved for use by the user.

It has no meaning attached to it. Usually, an identifier is a name provided by the user.

No special symbol is used.

Except for the underscore, no other special symbol is used.

It specifies the type of entity.

It gives a name to the type of entity.

Example: void, int, signed, etc.

Example: test, _abc, etc.

What is a Keyword in C?

Keywords are predefined reserved words present to the user in the C language. Any C program must have keywords present in it. In fact, a program in C begins with the keyword itself. The keyword is a type of C token which is used for formulating various problems in the GATE question paper.

In C, there are 32 reserved words or keywords present. Keywords are used in functions, blocks, loops, user-defined data structures, etc. The keywords are as follows: auto, default, float, register, struct, volatile, break, do, for, return, switch, while, char, else, if, signed, union, case, double, goto, short, typedef, const, enum, int, sizeof, unsigned, continue, extern, long, static, void.

What is an Identifier in C?

An identifier is a name given to memory space or a function for future reference in the program. An identifier does not have predefined meanings. They are user-defined names composed of letters and digits.

For an identifier to be valid, we need to follow the predefined rules to declare an identifier that is an identifier should only begin with a letter or an underscore and not by any digit. Identifiers are essential for the GATE exam. It cannot contain any special symbol other than letters, digits, or underscore.

Check out the following topics related to the difference between keywords and identifiers:

Related GATE Notes
Difference Between MAC Address and IP Address Difference Between POP and OOP
Difference Between mealy machine and moore machineDifference between derived and fundamental data types
Difference between network and internetDifference between exothermic and endothermic reactions
Difference Between overloading and overridingDifference between HTTP and HTTPS

Comments

write a comment

FAQs on Difference Between Keywords and Identifiers

  • There are various differences between keywords and identifiers. In terms of entity, a keyword specifies the type of entity. On the other hand, an identifier just provides a mere name to the type of entity.

  • In C programming, a token is defined as the smallest individual unit in a program. In C, we have five types of tokens. Every token holds a special functionality in itself. They are:

    ·      Keywords

    ·      Identifiers

    ·      Operators

    ·      Constants

    ·      Special symbols

  • In C, a keyword is also called a reserved word. A keyword has a predefined meaning. In C programming, there are 32 keywords present for user convenience. Some of the keywords are as follows: void, signed, int, volatile, main, getch, etc.

  • Keywords and identifiers in C are two different token types. A keyword has a predefined meaning and functionality. On the other hand, an identifier has no particular meaning. It is only provided by the user or programmer.

  • A keyword can only start in lowercase. All the keywords present in C are in lowercase and do not contain any special symbol. On the other hand, an identifier can start with lowercase, uppercase, or underscore. An Identifier allows only underscores and no other special symbols.

Follow us for latest updates