Identifiers in C
The names of user-defined variables, functions, arrays, etc. are called Identifiers. Technically Identifiers are nothing, these are just user-given names to the variable, function, arrays, etc. so that we can easily identify those elements by their names. Identifiers are not any extra things, these are the terms for just calling purposes.
For example, we humans get identified with our names, identity documents, etc. we can say our names are identifiers, our documents are identifiers.
Rules for writing an identifier
- The first character must be an alphabet or underscore.
- Only letters, digits, or underscores are allowed.
- White space is not allowed.
- C keywords can not be used as identifiers.
- Maximum 31 numbers of characters are allowed in an identifier.
Points About C Identifiers
- These user-defined names consist of a sequence of letters and digits.
- Lower-case and upper-case letters, both are allowed.
- Underscore ( _ ) is also allowed.
- Generally, we use underscore as a link between two words in the long identifier for example user_Name.
Identifiers Example
#include<stdio.h>
void main()
{
int first_Num;
int second_Num;
int result;
first_Num=20;
second_Num=30;
result = first_Num + second_Num;
printf(result);
}
Note:
- In the above example, first_Num, second_Num, and result are called identifiers.
- Don’t confuse first_Num, second_Num, and the result are variables, they are just called identifiers.