During execution of the program, you may require a container (variable) to hold input or output or an intermediate value.
These values are stored in computer’s memory at a different memory locations. To refer these memory locations, we need to use identifier.
What is identifier?
Identifiers is a name that is given to various program elements such as variables, symbolic constants, functions, structures or enums. The identifier is used to identify a user-defined item.
Example:
1 2 3 4 |
int marks; char name; char G9; double total; |
In the above examples int, char, double are keywords whereas marks, name, total are identifiers.
Rules for Naming C Identifiers
- An identifier can only start with letter (A-Z, a-z) or underscore( _ ) symbol.
- An identifier can contain alphabet, digits(0-9), and underscore only.
- The identifier must not contain white spaces.
- A keyword can not use as an identifier.
- You can not use punctuation characters (@, #, $, %, &) as identifers.
- As C is a case-sensitive language. Thus, MARKS, Marks, marks are different identifiers.
- So identifier name should be unique.
- Length of an identifier can contain 31 characters.