C-language Operator precedence summary

Source: Internet
Author: User
Tags bitwise

Note: The label 1-15 priority is from high to low.

Priority level Operator Meaning Number of operations Combination direction

1


() [].

Parentheses subscript operator Pointer to struct member operator struct member operator


From left to right




2

       !

       ~

       ++

       --

       -

      (type)

        *

        &

     sizeof

Logical Non-

Bitwise REVERSE

Self-increment

Self-reduction

Minus sign

Type conversions

Pointer operators

Take address character

Length operator




1 (single-mesh operator)






From right to left

3 *  /  % Multiplication, division, redundancy 2 (binocular operator) From left to right
4 + - addition, subtraction 2 (binocular operator) From left to right
5 << >> Move left, move right 2 (binocular operator) From left to right
6 < <= > >= Relational operators 2 (binocular operator) From left to right
7 = =! = equals Not equal to operator 2 (binocular operator) From left to right
8 & Bitwise-AND 2 (binocular operator) From left to right
9 ^ Bitwise XOR OR 2 (binocular operator) From left to right
10 | Bitwise OR 2 (binocular operator) From left to right
11 && Logic and operations 2 (binocular operator) From left to right
12 || Logical OR operation 2 (binocular operator) From left to right
      3 (trinocular operator) from right to left
     

= + = = *=/=

%= >>= <<= &= 

^= |=

assignment operator

    

          2

15 Comma operator
From left to right

Memory Method:

Elementary operator: () The bitwise operator--operator--operator------------ ), the assignment operator, the conditional operator, and the comma operator

C-language Operator precedence summary

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.