int x = 6, y = 6;

cout << x << " " << y << endl;

cout << x++ << " " << y-- << endl;

cout << x << " " << y << endl;


return 0;


<결과>

6 6

6 6

7 5 


++x 와 x++는 다르다. 

'programming > c++' 카테고리의 다른 글

3.5 관계 연산자(부등호)  (0) 2019.04.19
3.4 sizeof, comma operator, conditional operator  (0) 2019.04.19
2.9 심볼릭 상수  (0) 2019.04.16
2.8 리터럴 상수  (0) 2019.04.16
2.7 문자형 char type  (0) 2019.04.15
Posted by 도이(doi)
,