![]() |
VOOZH | about |
In C programming, identifiers are the names used to identify variables, functions, arrays, structures, or any other user-defined items. It is a name that uniquely identifies a program element and can be used to refer to it later in the program. Example:
In the above code snippet, "val" and "func" are identifiers.
A programmer must follow a set of rules to create an identifier in C:
The below image and table show some valid and invalid identifiers in C language.
The following code examples demonstrate the creation and usage of identifiers in C:
10
30
In C programming, naming conventions are not strict rules but are commonly followed suggestions by the programming community for identifiers to improve readability and understanding of code. Below are some conventions that are commonly used:
Read about Differences between keywords and identifiers in C.
In the below code, we have used const as an identifier which is a keyword in C. This will result in an error in the output.