Difference between Keyword and Identifier in C (original) (raw)
Last Updated : 10 Jun, 2026
Keywords and Identifiers are the basic building blocks of a C program. Keywords are reserved words with predefined meanings, while identifiers are user-defined names used to identify program elements.
- Keywords define the syntax and structure of the C language and cannot be used as names.
- Identifiers are user-defined names given to variables, functions, arrays, structures, and other program elements.
Keyword
A keyword is a reserved word in C that has a special meaning predefined by the compiler. Keywords are part of the language syntax and cannot be used as identifiers.
- Keywords have predefined meanings in the C language.
- They cannot be used as variable, function, or class names.
| auto | break | case | char | const | continue | default | do |
|---|---|---|---|---|---|---|---|
| double | else | enum | extern | float | for | goto | if |
| int | long | register | return | short | signed | sizeof | static |
| struct | switch | typedef | union | unsigned | void | volatile | while |
Identifier
An identifier is a user-defined name used to identify variables, functions, arrays, structures, and other program elements. Identifiers help programmers give meaningful names to entities in a program.
- Identifiers are created by programmers.
- They must follow C naming rules and conventions.
**Example:
studentName
calculateSum
age
totalMarks
employee_id
Keyword Vs Identifier
| Feature | Keyword | Identifier |
|---|---|---|
| Definition | A reserved word with a predefined meaning in C. | A user-defined name used to identify program elements. |
| Purpose | Defines the syntax and structure of the language. | Names variables, functions, arrays, structures, etc. |
| Defined By | C Language | Programmer |
| Can Be Modified | No | Yes |
| Usage as Variable Name | Not Allowed | Allowed |
| Meaning | Fixed and predefined. | Depends on the programmer's choice. |
| Number Available | Limited and predefined. | Unlimited (within naming rules). |
| Examples | int, if, while, return | age, salary, display(), studentName |