표현식의 주요 기능은 '값'을 계산하는 것.
True => 1 출력.
False => 0 출력.
#include <stdio.h>
int main()
{
int x, y, apples; // declaration statement
apples = 3; // assignment statement
; //null statement
7;
1 + 2;
x = 4;
++x;
x = 1 + (y = 5); // y = 5 is subexpression
while (x++ < 10) // while statement (structured statements)
y = x + y;
printf("%d\n", y); // function statement
return 0; // return statement
}
x = 4;
의 main intent는 식을 계산하는 것이지만, x
에 4를 대입하는 기능이 수행된다.
Sequence point는 '값을 언제 계산하는가' 이다.
semi-colon이 있으면 컴퓨터가 '이제 expression의 값을 계산해도 되는구나'라고 알아듣고 계산한다.
while (x++ < 10)
와 같은 경우는 ;
이 아닌 )
에서 sequence point를 만난다. (x++ < 10)
은 full expression이다.
y = (4 + x++) + (6 + x++);
는 full expression이 아니다.