Rules to be followed while creating identifiers:
1. The first character of an identifier should always start with an alphabet or an underscore, which can be followed by either alphabets or digits or certain symbols.
2. An identifier may be of any length up to 32 characters. Some compilers limit the length to eight characters.
3. Identifiers can contain both uppercase and lowercase letters. C is case sensitive, that is, lowercase letters are not converted to uppercase letters when used in identifiers.
4. Special characters except underscore should not be used in identifiers. Successive underscores are also not allowed.
5. Identifiers should be single words i.e., blank spaces cannot be included in identifiers.
6. Reserved words should not be used as identifiers.
Legal identifiers |
Illegal identifier |
Legal but poor |
Sum
Emp_name
Student_address
Number
age |
Varun’s_addr
while
@total sum
do-it
counter
3by2 |
_help
sumo_1 |