按書中的說法C語言中沒有賦值語句,賦值是通過表達式語句完成的
x = y + z;
是合法的,這樣做可以在花括號內的代碼塊中引入一個臨時變量,只有這個代碼塊中的語句可以訪問。
0
1
2
3
4
5
6
7
8
9
用於判斷循環的表達式不需要初始化和調整時。
while 後面少了花括號
即使判斷條件爲假,循環體語句也至少需要執行一次的時候。
odd
even
odd
odd
even
odd
int count;
scanf("%d",&count);
for(int i=0;i<count;i++)
printf("\n");
if (x<y || a>=b)
printf("WRONG");
else
printf("RIGHT");
if(year % 400 == 0 || (year % 4 ==0 && year % 100 != 0))
leap_year = 1;
else
leap_year = 0;
switch(which_word)
{
case 1:printf("who");break;
case 2:printf("what");break;
case 3:printf("when");break;
case 4:printf("where");break;
case 5:printf("why");break;
default:printf("don't know");break;
}
while(hungry())
eat_hamberger();
do
eat_hamberger();
while(hungry());
if(precipitating)
{
if(temperature<32)
printf("snowing");
else
printf("raining");
}
else
{
if(temperature<60)
printf("cold");
else
printf("warm");
}