Home>Article>Backend Development> Are keywords allowed for identifiers in C language?
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.
# Are keywords allowed for identifiers in C language?
C language identifiers do not allow the use of keywords.
No matter what language it is. Keywords have been stipulated by the language itself, and the meaning they represent is uniquely determined. If it is used as a user identifier, there will be ambiguity (or ambiguity); this is not in line with the certainty of program design.
Introduction to identifiers in c language
#Identifiers consist of letters (A-Z, a-z), numbers (0-9), and underscores "_ ”, and the first character cannot be a number, but can be a letter or underscore. For example, correct identifiers: abc, a1, prog_to.
C language keywords cannot be used as user identifiers, such as if, for, while, etc.
The identifier length 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 Some industry standards are longer).
Identifiers are case-sensitive, that is, they are strictly case-sensitive. Generally use lowercase for variable names and uppercase for symbolic constants.
Identifier naming should be done so that the meaning is known by the name, for example, length (length), sum, total (sum), pi (pi)...
In C language, identifiers are divided into three categories: keywords, predefined identifiers, and user-defined identifiers.
Recommended: "c Language Tutorial"
The above is the detailed content of Are keywords allowed for identifiers in C language?. For more information, please follow other related articles on the PHP Chinese website!