C-language operator precedence

Source: Internet
Author: User
Tags bitwise

Priority level Operator Name or meaning Use form Combination direction Description
1 Rear-facing + +
  
Post-increment operator Variable name + + Left to right  
Rear--
  
Post-decrement operator Variable name--
  

  
[ ] Array subscript array name [INT-expression]
  
( ) Parentheses (expression)/function name (formal parameter list)  
. Member selection (object) Object. Member name  
- Member selection (pointer) Object pointers, member names  
2 - Minus sign operator -expression Right to Left Monocular operator
Type Forcing type conversions (data type) expression  
Front + + Predecessor increment operator + + variable Name Monocular operator
Front-- Pre-decrement operator --Variable name Monocular operator
* Value operator * Pointer expression Monocular operator
& Fetch address operator & Left-value expressions Monocular operator
! Logical non-operator ! An expression Monocular operator
~ Bitwise inverse operator ~ Expression Monocular operator
sizeof Length operator sizeof expression/sizeof (type)  
3 / Except An expression/expression Left to right Binocular operator
* By Expression-expression * Binocular operator
% Remainder (modulo) Integer expression% integer expression Binocular operator
4 + Add An expression + an expression Left to right Binocular operator
- Reducing Expression-expression Binocular operator
5 << Move left Expressions << Expressions Left to right Binocular operator
>> Move right Expressions >> Expressions Binocular operator
6 > Greater than Expressions > expressions Left to right Binocular operator
>= Greater than or equal Expression->= expression Binocular operator
< Less than Expressions < expressions Binocular operator
<= Less than or equal Expression-<= expression Binocular operator
7 == Equals Expression-= = Expression Left to right Binocular operator
!= Not equal to Expression! = Expression Binocular operator
8 & Bitwise-AND Integer Expressions & Integer expressions Left to right Binocular operator
9 ^ Bitwise XOR OR Integer expression ^ int expression Left to right Binocular operator
10 | Bitwise OR int expression | int expression type Left to right Binocular operator
11 && Logic and Expressions && Expressions Left to right Binocular operator
12 || Logical OR An expression | | An expression Left to right Binocular operator
13 ?: Conditional operators Expression 1? Expression 2: Expression 3 Right to Left Trinocular operator
14 = Assignment operators variable = expression Right to Left  
/= Assign value after addition Variable-/= expression  
*= Multiply post-Assign value Variable-*= expression  
%= Assign value after modulo Variable-%= expression  
+= Add after Assignment Variable + = expression  
-= Reduced-value Assignment Variable-= expression  
<<= Assign value after left shift Variable-<<= expression  
>>= Assign value after right shift Variable->>= expression  
&= Bitwise AND post-assigned values Variable-&= expression  
^= Bitwise XOR or post-assignment Variable-^= expression  
|= Bitwise OR post-assigned value Variable-|= expression  
15 , Comma operator expression, expression,... Left to right Left-to-right sequential operation

C-language operator precedence

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.