III. C # Operator and Control Flow,

Source: Internet
Author: User
Tags bitwise operators

III. C # Operator and Control Flow,
Operators are generally divided into three categories: unary operators, binary operators, and ternary operators. Their corresponding operands are 1, 2, and 3. Combination and priority order. Binary operations combine from left to right, while the opposite value assignment operator combines from right to left. Char stores characters rather than numbers, but it is an integer. 1. float and double have some special characteristics. A float has a 7-bit precision. Only valid digits with 7-bit precision are allowed. Others will be truncated. There is a rounding error. When two values are equal, the inaccuracy of the floating point type may cause serious consequences. Sometimes, the values that should have been equal are incorrectly judged as not equal. 2. The position of the increment and Decrement Operators determines whether the assigned value is a value before or after the calculation of the operand. The operator adopts the suffix or prefix format. The only difference is that the value is assigned before or after the increment, and the affected variable will always change. Although the increment and decrease operators of thread security simplify the code, they do not execute atomic-level operations. During operator execution, thread context switching may occur and may cause a race condition. 3. constant expression const int a = 60*60*24; according to the definition, constant expression is the C # compiler completes the evaluate expression at compile time (instead of being evaluated when the program is running) 4. scope and declarative space refer to the hierarchical context defined by a code block. The scope is a specific source code region. In this region, it is completely legal to reference a project with an undefined name, because the name is unique and unambiguous. In a region, if the declared name is unique, this space is the declared space. The use of the domain limits the accessibility. 5. Logical boolean operator OR operator | if both are true, the trueAND operator & both are true, and the trueXOR operator ^ is returned. Only one of the two can be true, and the true logical inverse operator is returned! 6. What are the condition operators?: 7. The null join operator starts from C #2.0. The conditional operator that executes the null check has a simplified syntax called the null join operator, which checks whether an expression is null; if it is null, the second expression is returned. Or return the first expression expression1 ?? Expression2; 3.6. All values of bitwise operators and byte computers are in the binary format of 1 and 0. These 1 and 0 are bit or bit. A group of 8 bits is called byte ). Each consecutive bit corresponds to a power of 2. 1. Shift operators such as: 1> 21 <2 left shift: after the shift, the left blank space will be filled by 0 to the right shift: The left blank, the positive number is supplemented by 0, the negative number is supplemented by 1. The bitwise operator & | or ^ is different or ~ The C # pre-processor command C # pre-processing cry command is called at compilation. The Preprocessor instruction tells C # Compiler which code to compile and how to handle specific errors and warnings. Each Preprocessor command starts with a # And must be written in one line. Line Break, indicating the end of The Preprocessor command, not a semicolon. Find records online. Find out the player in appendix B.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.