In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you what are the variables and basic types of C++. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. Type conversion
The type of an object defines the data that an object can contain and the operations it can participate in, one of which is supported by most types, which converts an object from a given type to another related type.
such as
When assigning non-Boolean data to a Boolean type, the initial value is 0 and the result is false, otherwise it is true
When a Boolean value is assigned to a non-Boolean type, the result is 0 if the initial value is false, and 1 if the initial value is true
When a floating-point number is assigned to an integer type, the resulting value retains only the part before the decimal point of the floating-point number
When an integer value is assigned to a floating-point type, the decimal part is marked as 0. If the space occupied by the certificate exceeds the capacity of the floating-point type, the precision may be missing.
When an unsigned type is assigned a value that is outside its range, the result is the remainder after the initial value represents the total number of values for the unsigned type, such as:
Unsigned char c =-1 / / assume that char occupies 8 bits, and the result is that the binary representation of 255 / /-1 is changed from 11111111 to decimal.
When we assign a value to a signed type that is outside the range of its representation, the result is undefined. The program may continue to work or crash.
When a program uses a singular value of one arithmetic type somewhere, the compiler performs a type conversion when all it needs is a value of another type.
Expressions with unsigned types
When an arithmetic expression has both an unsigned number and an int value, the int value is converted to an unsigned number (if there are both signed and unsigned types in the expression, the signed number is automatically converted to an unsigned number):
Unsigned u = 10; / / unsigned is abbreviated for unsigned int int I = 42
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.
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.