Keywords and Identifiers in C
In this blog, you will understand the meaning of Keywords and Identifiers in C language. We will also cover topics like rules to declare the Identifiers and also the difference between Keywords and Identifiers.
Identifiers and Keywords are the basic things that you should know to create a C program.
What are Keywords in C?
A keyword is a reserved word in C programming. These keywords have a special meaning in compilers of the C language. These meanings cannot be changed. You cannot use these keywords as variable names because it would try to change the predefined meaning of the keyword, which is not allowed. There are 32 reserved keywords in C language
What are Identifiers?
In C language identifiers are the names given to variables, functions, constants, and user-defined data. These identifiers are defined according to some rules.
Rules for an Identifier
- An identifier can only have alphabetic(a to z, A to Z), numeric character(0 to 9), and underscore( _ ).
- The first character of an identifier can only have an alphabet(a to z, A to Z) or underscore( _ ).
- Identifiers are also case sensitive. For example, a and A, name, and Name are to different identifiers.
- No special characters like semicolons, whitespaces, slash, or comma are not allowed to be used as identifiers.
- Keywords are not allowed to be used as identifiers.
Difference between Keywords and Identifiers
Sr. no. | Keywords |
Identifiers |
---|---|---|
1 | Keywords are reserved in the C language | Identifiers are the user-define names of functions and variables. |
2 | Specify the type or kind of entity. | Identify the name of a particular entity. |
3 | It always starts with a lower case letter. | The first letter can be lowercase, uppercase, or underscore. |
4 | The Keyword contains only alphabetic characters. | An Identifier can contain alphabetical character, digits, or underscore. |
5 | They help to identify a specific property that exists within a computer language. | They help to locate the name of the entity that gets defined along with a keyword. |
6 | No special symbol, punctuation is used. | No punctuation or special symbol except 'underscore' is used. |
Comments
Post a Comment