연산자의 우선순위 단계 오류의 고통스러운 대가
3201 단어 연산자
Operator
Description
Associativity
일
:: Scope resolution
Left-to-right
이
++ -- Suffix/postfix increment and decrement
() Function call
[] Array subscripting
. Element selection by reference
-> Element selection through pointer
삼
++ -- Prefix increment and decrement
Right-to-left
+ − Unary plus and minus
! ~ Logical NOT and bitwise NOT
(type) Type cast
* Indirection (dereference)
& Address-of
sizeof Size-of
new , new[] Dynamic memory allocation
delete , delete[] Dynamic memory deallocation
사
.* ->* Pointer to member
Left-to-right
오
* / % Multiplication, division, and remainder
육
+ − Addition and subtraction
칠
<< >> Bitwise left shift and right shift
팔
< <= For relational operators < and ≤ respectively
> >= For relational operators > and ≥ respectively
구
== != For relational = and ≠ respectively
십
& Bitwise AND
십일
^ Bitwise XOR (exclusive or)
십이
| Bitwise OR (inclusive or)
십삼
&& Logical AND
십사
|| Logical OR
십오
?: Ternary conditional
Right-to-left
= Direct assignment (provided by default for C++ classes)
+= −= Assignment by sum and difference
*= /= %= Assignment by product, quotient, and remainder
<<= >>= Assignment by bitwise left shift and right shift
&= ^= |= Assignment by bitwise AND, XOR, and OR
십육
throw Throw operator (for exceptions)
십칠
, Comma
Left-to-right
<>의 우선 순위가 +보다 높아 잘못된 결과를 초래했다고 생각합니다!
short c = (short)( (high << 8) + low);
short d = (short)( high << 8 + low);
short f = (short)( high << (8 + low));
// d f ,
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
4일차 java - 변수와 연산자2) 영문자,숫자,_를 사용할 수 있다. 3) 예약어를 사용할 수 없다(int나 String같은 기능이 있는 단어는 안됨) 4)특수문자, 공백을 사용할 수 없고, 숫자로 변수명이 시작되면 안된다. 자료형(Data T...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.