Home > Article > Backend Development > Identifiers in C language can only consist of which three characters?
C language identifiers can only be composed of three characters: letters (A-Z, a-z), numbers (0-9), and underscore "_"; and the first character cannot be a number, but it can be a letter Or underline. C language keywords cannot be used as user identifiers; identifiers are case-sensitive, that is, they are strictly case-sensitive.
Identifier refers to a symbol used to identify an entity and has different meanings in different application environments. In computer programming languages, identifiers are names used by users when programming. They are used to name variables, constants, functions, statement blocks, etc., to establish a relationship between name and use. Identifiers usually consist of letters, numbers, and other characters.
C Identifier is the name used to identify a variable, function, or any other user-defined item. An identifier starts with the letters A-Z or a-z or the underscore _, followed by zero or more letters, underscores, and numbers (0-9).
Naming convention for identifiers in C language:
1. Identifiers consist of letters, numbers, and underscores, and the first letter cannot be a number. (Punctuation characters, such as @, $ and %, are not allowed in C identifiers.)
2. Identifiers are case-sensitive, that is, they are strictly case-sensitive. Generally use lowercase for variable names and uppercase for symbolic constants. (Note: Letters in C language are case-sensitive, so score, Score, and SCORE represent three different identifiers respectively)
3. C keywords cannot be used as user identifiers, for example: if, for, while, etc. (Note: The identifier cannot be the same as a C language keyword, nor can it have the same name as a user-defined function or C language library function. For is OK because it is case-sensitive.) C language keywords (32 5 7)
4. The length of the identifier is determined by the compilation system on the machine. The general limit is 8 characters. (Note: The 8-character length limit is the C89 standard. The C99 standard has expanded the length. In fact, most industrial standards longer).
5. Identifier naming should be such that "the meaning is known by the name", for example, length (foreign language: length), sum, total (foreign language: sum), pi (foreign language: pi)
Related recommendations: "c Language Tutorial"
The above is the detailed content of Identifiers in C language can only consist of which three characters?. For more information, please follow other related articles on the PHP Chinese website!