Actually,
Identifiers are names for entities in a C program, such as variables, arrays, functions, structures, unions and labels.
Rules for constructing identifiers 1. The first character in an identifier must be an alphabet or an underscore and can be followed only by any number alphabets, or digits or underscores. 2. They must not begin with a digit. 3. Uppercase and lowercase letters are distinct. That is, identifiers are case sensitive. 4. Commas or blank spaces are not allowed within an identifier. 5. Keywords cannot be used as an identifier. 6. Identifiers should not be of length more than 31 characters. 7. Identifiers must be meaningful, short, quickly and easily typed and easily read. Valid identifiers:
total sum average _x y_ mark_1 x1 Invalid identifiers 1x - begins with a digit char - reserved word x+y - special character Note: Underscore character is usually used as a link between two words in long identifiers. |
C defines two kinds of identifiers:
Internal identifier If the identifier is used in an external link process, then it is called as external. These identifiers are also known as external names; include function names and global variable names that are shared between source files. It has at least 63 significant characters. If the identifier is not used in an external link process, then it is called as internal. Example: Local variable. External identifier If the identifier is not used in an external link process, then it is called as internal. These identifiers are also known as internal names; includes the names of local variables. It has at least 31 significant characters. If the identifier is used in an external link process, then it is called as external. Example: Global variable
|
Difference between Keyword and Identifier
Keyword
|
Identifier
|