본문 바로가기
C++(홍정모의 따배씨++)

1.8 연산자와의 첫 만남

by 안장환 2021. 8. 5.

리터럴 Literal

피연산자 Operand

단항 unary

이항 binary

삼항 ternary

 

int x =2 ; // x is variable, 2 is a literal

cout << "My home"<<endl;  // "My home" is literal

cout << x+2<<endl; //  x is variable + is operator 2 is literal. x and 2 is operand.

 

삼항연산자

int y = (x>0) ? 1: 2;

댓글