Identifiers in C language represent the name in the C programming language, for example, the name of the variable, the name of the function, the name of the array, the name of the structure, the name of unions, the name of labels, etc.
An Identifier can be a combination of alphanumerical characters that should be starting with alphabetical characters or an underscore. An identifier cannot contain any space.
Rule of creating an identifier in C language
- The first character of the identifier should be starting with an alphabet or an underscore, then it can contain alphabet and numerics.
- The first character should not be a number.
- The identifier is case-sensitive.
- Commas and blank spaces cannot be used in an identifier.
- Keywords cannot be used as an identifier.
- The length of the identifier should not exceed 31 characters.
- An identifier should be meaningful as well as short and easy to read.
Examples of valid identifiers:
total, addition, factorial, _total, _sum, etc.
Example of invalid identifiers:
0add, total sum, @sum, etc.