About the three-mesh operator in C language using attention __c language

Source: Internet
Author: User
Tags arithmetic operators

Recently, in view of the camera drive, I found a paragraph so written for me this little white was a bit of a monk. Finally think of it is nothing but the C language of the three-mesh operator nesting.  The above figure is equivalent to Ireg = Ireg < 0x10?0x10: (Ireg>0xf8?0xf8:ireg); The value of Ireg is understood to be compared with 0x10, less than 0x10 to 0x10. Take (Ireg>0xf8?0xf8:ireg) This value if it is not established. One more judgment. Write it, Mark.

Then the three-mesh operation on the C language was measured again.



Change Order enter above four values:


When you summarize the use of conditional expressions, you should also note the following points:
1. The operation precedence of the conditional operator is lower than the relational and arithmetic operators, but is higher than the assignment character. So max= (a>b) a:b can remove parentheses and write as Max=a>b?a:b
2. The conditional operator? And: is a pair of operators that cannot be used separately.
3. The binding direction of the conditional operator is from right to left.
For example:
A>b?a:c>d?c:d should be understood as
A>b?a: (C>D?C:D) This is the case where the conditional expression is nested, where the expression 3 is a bar
A piece of expression.


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.