Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of user identifier in C language

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "what is the concept of user identifier in c language". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In C language, the user identifier is a symbol defined by the user to identify an entity; it is generally used to name variables, functions, arrays, etc., in order to establish the relationship between name and use. The identifier consists of letters, underscores, and numbers, and the first character must be a letter or underscore, not a number.

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

Identifier is 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, which are used to name variables, constants, functions, statement blocks, etc., in order to establish the relationship between name and use. Identifiers usually consist of letters and numbers and other characters.

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

Keyword: cannot be used as a user identifier. Main define scanf printf is not even a keyword. What puzzles 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 as needed. It is generally used to name variables, functions, arrays, etc. If the user identifier is the same as the keyword, there will be an error at compile time; if it is the same as the predefined identifier, there will be no error at compile time, but the original meaning of the predefined identifier will be lost, or it may cause an error in the result. therefore, predefined identifiers are generally not used as user identifiers.

C language user identifiers should generally follow the following naming rules:

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

2. Identifiers distinguish between uppercase and lowercase letters

3. The length of the identifier should be within 31 characters in c89 and 63 characters in c99.

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

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

This is the end of the content of "what is the concept of user identifier in C language". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report