Home  >  Article  >  Backend Development  >  Are keywords allowed for identifiers in C language?

Are keywords allowed for identifiers in C language?

青灯夜游
青灯夜游Original
2020-04-16 15:39:409768browse

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?

# 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

  1. #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.

  2. C language keywords cannot be used as user identifiers, such as if, for, while, etc.

  3. 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).

  4. Identifiers are case-sensitive, that is, they are strictly case-sensitive. Generally use lowercase for variable names and uppercase for symbolic constants.

  5. 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn