In C programming language, programmers can specify their own name to variable, array, pointer, function, lable etc... Identifier is a collection of characters which acts as name of variable, function, array, pointer, strcture, lable etc... In other words, an identifier can be defined as user defined name to identify an enity uniquely in c programming language that name may be of variable name, function name, array name, pointer name, structure name or a lable.
Identifier is a user defined name of an entity to identify it uniquely during the program execution
Here, marks and studentName are identifiers.
Rules for Creating Identifiers
- An identifier can contain letters (UPPERCASE and lowercase), numerics & underscore symbol only.
- An identifier should not start with numerical value. It can start with a letter or an underscore.
- We should not use any special symbols in between the identifier even whitespace. However, the only underscore symbol is allowed.
- Keywords should not be used as identifiers.
- There is no limit for length of an identifier. However, compiler consider first 31 characters only.
- An identifier must be unique in its scope.
Rules for Creating Identifiers for better programming
The following are the commonly used rules for creating identifiers for better programming...
- The identifier must be meaningfull to describe the entity.
- Since, starting with underscore may create conflict with system names, so we avoid starting an identifier with underscore.
- We, start every identifier with a lowercase letter. If identifier contains more than one word then first word starts with lowercase letter and second word onwords first letter is used as UPPERCASE letter. We can also use an underscore to separate multiple words in an identifier.