Read the "C # Primer Classic"

Source: Internet
Author: User
Tags bitwise operators
C # is also regarded as halfway decent, the foundation is not very good, these days to learn a bit of the "C # Introductory Classic," is a cornerstone of the. The first three chapters have been read, today began to read the fourth chapter.


§1 C # Introduction

§2 Write C # programs

§3 Variables and expressions

§4 Process Control


Branches, loops

§4.1 Boolean logic

Boolean Compare relational operators
=,!=, <=, >=

BOOL IsLessThan10;
IsLessThan10 = Myval < 10;

! Logical non
& Logic and
| Logical OR
^ Logical XOR or


&&,| | Better performance: First check the value of the first operand, the second may not need to check

1. Bitwise operators
and; | These two operators can be used to perform operations on numeric values, in fact, they are dealing with a series of bits stored in a variable, not the value of a variable
^
~ Take the Counter
>>,<< v1 = v2 >> v3; The value of V1 is obtained by moving the binary value of the V2 to the right v3 bit.
2. Boolean assignment operator
&= Use & &&
|= Use | rather than | |
^=
>>=
<<=
3. Precedence update of Operators
High + +,--, (for prefix); (); +,-(one yuan);!; ~
*, /, %
+, -
<&lt, >>
| >,<=, >=
| ==, !=
| &
| ^
|
&&
||
=, *=,/=,%=, + =, =, <<=, >>=, &=, ^=, |=
Low + +,--(used as suffix)





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.