"C언어 연산자 우선순위"의 두 판 사이의 차이

 
(같은 사용자의 중간 판 3개는 보이지 않습니다)
3번째 줄: 3번째 줄:
*C언어 연산자 우선순위 테이블  
*C언어 연산자 우선순위 테이블  
{| class='wikitable'
{| class='wikitable'
! 순위 !! 연산자 분류 !! 연산자 !!  연산 방향  
! Category !! Operator !! Associativity
|-
|-
| 1 ||  괄호, 배열, 구조체 ||  ( )  [ ]  ->  .   || 좌→우
| Postfix || () [] -> . || Left to right
|-
|-
| 2 ||  단항 연산자 ||  *(간접)  &(주소)  !  -  ++  --  +(부호)  -(부호)  sizeof  new  delete || 우→좌 ★
| Unary || =+ - ! ~ ++ - - (type)* & sizeof || Right to left
|-
|-
| 3 ||  구조체 결합연산자 ||  .*  ->* || 좌→우
| Multiplicative || * / % || Left to right
|-
|-
| 4 ||  승제 연산자 ||  *  /  % || 좌→우
| Additive || =+ - || Left to right
|-
|-
| 5 ||  가감 연산자 ||  +  - || 좌→우
| Shift || << >> || Left to right
|-
|-
| 6 ||  시프트(Shift) 연산자   ||  <<  >> || 좌→우
| Relational || < <= > >= || Left to right
|-
|-
| 7 ||  비교 연산자 ||  <  <=  >  >= || 좌→우
| Equality || == != || Left to right
|-
|-
| 8 ||  등가 연산자 ||  ==  != || 좌→우
| Bitwise AND || & || Left to right
|-
|-
| 9 ||  비트 연산자 AND ||  & || 좌→우
| Bitwise XOR || ^ || Left to right
|-
|-
| 10 ||  비트 연산자 XOR ||  ^ || 좌→우
| Bitwise OR || <nowiki>|</nowiki> || Left to right
|-
|-
| 11 ||  비트 연산자 OR ||  <nowiki>|</nowiki> || 좌→우
| Logical AND || && || Left to right
|-
|-
| 12 ||  논리 연산자 AND ||  && || 좌→우
| Logical OR || <nowiki>||</nowiki> || Left to right
|-
|-
| 13 ||  논리 연산자 OR ||  <nowiki>||</nowiki> || 좌→우
| Conditional || ?: || Right to left
|-
|-
| 14 ||  조건 연산자 ||  ?: || 우→좌 ★
| Assignment || = += -= *= /= %=>>= <<= &= ^= |= || Right to left
|-
|-
| 15 ||  대입 연산자 ||  =  *=  /=  +=  -=  %=  <<=  >>=  &=  ^=  |= || 우→좌 ★
| Comma || , || Left to right
|-
| 16 ||  나열 연산자 ||  , || 좌→우
|}
|}
연산자 우선순위는 암기를 필요로 하지는 않으나 필요시 참고
연산자 우선순위는 암기를 필요로 하지는 않으나 필요시 참고


<span style="color:white">괄첨화점 별참느뿔마</span>
<span style="color:white">괄첨화점 참별마뿔느</span>


==같이 보기==
==같이 보기==

2017년 5월 18일 (목) 21:50 기준 최신판

1 개념[ | ]

C언어 연산자 운선순위
  • C언어 연산자 우선순위 테이블
Category Operator Associativity
Postfix () [] -> . Left to right
Unary =+ - ! ~ ++ - - (type)* & sizeof Right to left
Multiplicative * / % Left to right
Additive =+ - Left to right
Shift << >> Left to right
Relational < <= > >= Left to right
Equality == != Left to right
Bitwise AND & Left to right
Bitwise XOR ^ Left to right
Bitwise OR | Left to right
Logical AND && Left to right
Logical OR || Left to right
Conditional ?: Right to left
Assignment = Right to left
Comma , Left to right

연산자 우선순위는 암기를 필요로 하지는 않으나 필요시 참고

괄첨화점 참별마뿔느

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}