ArticleDirectory
C ++ operator precedence
C ++ operator precedence
The operators at the top of this list are evaluated first.
Precedence
Operator
Description
Example
Associativity
1
::
Learn from: http://lasombra.iteye.com/blog/991662http://blog.csdn.net/xiaoli_feng/article/details/4567184Monocular multiplication is the relationship, and the logic is assigned after three eyes.Monocular: monocular operator +– (negative) +
A total of 15 priority levels:1 () []. -2! ~-(minus) + +--& (take variable address) * (type) (mandatory type) sizeof3 */%4 +-5 >> 6 > >= 7 = = =!8 &9 ^10 |&&12 | |13?:+ = = *=/=%= |= ^= &= >>= 15,It's just a lot of it. Binding: 2 13 14 is from right
====================================="C + + operator precedence combined with mnemonic word"(Novice on the road an original, a total of 20 + 1 sentences)function class name full;Point Arrow beacon structure;After the increase or decrease of
Whenever you want to find which operator priority high, many times always want to find no, really let people angry! Now, finally have a I personally feel very full of, share to everyone, welcome to shoot Bricks!C-language operator precedence
Tag: expression operator Select value Comma operator combined = = Direction greater thanC-language operator precedence
Priority level
Operator
Name or meaning
Use form
Combination direction
Description
Often write the program, encountered the problem of operator precedence, I am ashamed of IS, check the number of books quite a lot of ... Mercilessly, summed up under. But also to combine a lot of programming practice to go into the mind.1, the
A total of 15 priority levels:1 () []. -2! ~-(minus) + +--& (take variable address) * (type) (mandatory type) sizeof3 */%4 +-5 >> 6 > >= 7 = = =!8 &9 ^10 |&&12 | |13?:+ = = *=/=%= |= ^= &= >>= 15,Just a lot of it. Binding: 2 13 14 is from right to
Operator precedence from high to low
Priority Level
operator
Description
Example
Binding Nature
1
()[]-.::++--
The parentheses operator that adjusts the precedenceArray Subscript access
C-language operator precedence
Priority level
Operator
Name or meaning
Use form
Combination direction
Description
1
[]
Array subscript
array name [constant expression]
Left to
An operator is a symbol that tells the compiler to perform a specific mathematical or logical operation. C + + has a rich operator built into it and provides the following types of operators:
Arithmetic operators
Relational operators
C -language operator precedence
Priority level
Operator
Name or meaning
Use form
Combination direction
Description
1
[]
Array subscript
array name [constant expression]
Left
C-language operator precedence
Priority level
Operator
Name or meaning
Use form
Combination direction
Description
1
[]
Array subscript
array name [constant expression]
Left to
C + + Operator precedence
The operators at the top of this list are evaluated.
Precedence
Operator
Description
Example
associativity
1
::
Scoping operator
Class::age = 2;
None
2
1. | | && is right-associative2. + +--is calculated before the end of the entire expression operation or the start. is not just an operator.int i=1,j;j=i+++i+++i++; i=4,j=3;int i=1,m;M=++i+++i+++i; i=4,m=12;3.a+++b;The result is (a++) +b or A + (++b)
Priority level
Operator
Name or meaning
Use form
Combination direction
Description
1
Rear-facing + +
Post-increment operator
Variable name + +
Left to right
Rear--
First level (4, from left to right): [] array subscript, () parentheses,. Member selection (object), member selection (pointer)Second level (9, right-to-left union):-Minus sign operator, (type) coercion type conversion, + + increment operator
Priority level
Operator
Name or meaning
Use form
Combination direction
Description
1
[]
Array subscript
array name [constant expression]
Left to right
--
()
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.