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 are the conditions for user identification to conform to the law 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 mainly introduces "what are the conditions for user identification in C language to comply with the law". In daily operation, I believe that many people have doubts about the conditions for user identification to comply with the law in C language. I have consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the questions of "what are the conditions for user identification in C language to comply with the law?" Next, please follow the editor to study!

The user ID conforms to the conditions of the law: 1, it can only be composed of letters (A to Z), numbers (0 to 9) and the underscore "_", and the first character must be a letter or an underscore, not a number; 2, identifiers cannot use keywords (reserved words).

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

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.

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. Keywords have special meaning and cannot be used as identifiers

The following are legal identifiers:

A, x, x3, BOOK_1, sum5

The following is an illegal identifier:

3s cannot start with a number

Illegal character appears in sprinter *

-3x cannot start with a minus sign (-)

Illegal character minus sign appears in bowy-1 (-)

Note:

In C, identifiers are case-sensitive; for example, BOOK and book are two different identifiers.

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

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

Although identifiers can be defined by programmers at will, identifiers are symbols used to identify a certain quantity, so naming should have corresponding meaning as far as possible so that it can be read and understood "as the name implies".

At this point, the study of "what are the conditions for user identification in C language to comply with the law" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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