What does user identifier mean in C language?

青灯夜游
Release: 2023-01-06 11:18:13
Original
43567 people have browsed it

In the C language, a user identifier refers to a symbol defined by the user to identify an entity according to his or her needs; it is generally used to name variables, functions, arrays, etc., to establish names and usage The relationship between. Identifiers consist of letters, underscores, and numbers, and the first character must be a letter or underscore, not a number.

What does user identifier mean in C language?

The operating environment of this tutorial: windows7 system, c99 version, Dell G3 computer.

Identifier (identifier) ​​refers to a symbol used to identify an entity, which 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.

Identifiers are divided into keywords, predefined identifiers, and user identifiers.

  • Keyword: cannot be used as user ID. main define scanf printf are not keywords. What confuses you is that If can be used as a user identifier. Because the first letter in If is capitalized, it is not a keyword.

  • Predefined identifiers: recite define scanf printf include. Remember that predefined identifiers can be used as user identifiers.

  • User identifier: An identifier defined by the user according to their needs. Generally used to name variables, functions, arrays, etc. If the user identifier is the same as a keyword, an error will occur during compilation; if it is the same as a predefined identifier, no error will occur during compilation, but the original meaning of the predefined identifier will be lost or the result will be wrong, so predefined identifiers Generally not used as a user identifier.

User identifiers in C language should generally follow the following naming rules:

1. Identifiers can only consist of letters (A~Z , a~z), numbers (0~9) and underscores (_), and the first character must be a letter or underscore, not a number.

2. Identifiers are case-sensitive;

3. The length of the identifier, c89 stipulates that it should be within 31 characters, and c99 stipulates that it should be within 63 characters;

4. Keywords in C language have special meanings and cannot be used as identifiers;

5. It is best to use a string with a certain meaning for a custom identifier to facilitate memory and understanding.

Related recommendations: "C Language Video Tutorial"

The above is the detailed content of What does user identifier mean in C language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template