Identifier in C
Identifiers in the C programming are defined elements like the name of variables, function arrays, structures, etc, They are the fundamental requirement of any language.
These are token which is composed of a sequence of letters, digits, and underscore ( _ ).
Every language has its own rules for naming identifiers. Identifiers are used to give unique names to different objects in the program.
Rules For Naming Identifiers in C
- An identifier is any combination of alphabets, digits, or underscores.Â
- The first character in the identifier name must be an alphabet and not a digit but after that, any digit may follow.Â
- No blank (white space) is allowed within an identifier.Â
- No special symbols other than underscore(as in stn_name) can be used in an identifier.Â
- A maximum length of an identifier is compiler dependent. Originally it was 8 characters. ANSI C permits 31 characters in identifiers.Â
- Upper case and lower case letters are distinct.Â
- A keyword cannot be used as an identifier.Â
- The identifier name should be unique.Â
- The Same Identifier cannot be used again to give the name to another object.
C Identifier Example
Following are some possible examples of identifiers to represent the length of the box;Â
LengthOfBox
Lenght_of_box
length2
LenGth
lb
l