In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the relevant knowledge of "what are the knowledge points of C++ Primer variables". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope this article "what are the knowledge points of C++ Primer variables" can help you solve the problem.
Variables are generally defined in the form of type specifiers, variable names, and initialization.
one。 Type specifier
Type specifiers are generally the type keywords and custom classes that are included in commonly used systems such as int,double,char.
two。 Variable name
The variable name is generally composed of English letters (lowercase), numbers, and underscores (_), in which the number cannot be the first digit of the variable name.
Int a; / / legal int _; / / legal int 8; / / invalid. The number cannot be used as the variable name int _ 8; / / legal int a8; / / legal int a8; / / legal int _ A8; / / legal int 8; / / invalid. The number begins with an int variable. / / specially, Chinese characters are allowed as variable names in the Category 11 standard.
1. When naming a general standard, it needs to reflect its functional significance to a certain extent, such as:
The variable that records the score can be named score, the variable that records the number can be named num, and so on.
two。 Variable names should be lowercase as much as possible, and class names are usually capitalized.
3. When multiple words are needed to express meaning, a clear distinction needs to be made between words, such as:
The variable that records the student's name can be named student_name or studentName, and try not to write it as studentname.
4. The variable name cannot be a keyword or similar name, such as
Char int; / / is illegal, the key word intchar Int; / / is legal, but not recommended, it is easy to cause confusion char int; / / illegal, the key word intchar Int; / / is legal, but not recommended, it is easy to cause confusion. Initialization
Initialization is a complex concept. I won't delve into it here, but I just need to know that it is different from the assignment operation. Initialization is to give the initial value when the variable is defined, and assignment is to erase the old value and give the new value after the variable is created:
Int iTun6; / / defines int variable I and initializes 1 to 6 int I; / defines int variable iiqu6; / / assigns I to 6
There may be doubts: just said, the assignment to erase the old value to give a new value, there seems to be no old value, how to erase it?
In fact, when defining variable I, since there is no artificial initialization, the system automatically calls the constructor of int to initialize I, usually 0 (an inexact value, depending on the variable type and compiler environment). So later, changing the value of I to 6 is to erase the old value initialized by the system and give me a new value.
This is the end of the introduction of "what are the knowledge points of C++ Primer variable". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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: 282
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.