作者bjk (Up2u)
看板C_and_CPP
標題[問題] m = ++i && ++j || ++k;
時間Wed Feb 29 21:35:53 2012
int main()
{
int i=-3,j=2,k=0,m;
m = ++i && ++j || ++k;
printf("%d %d %d %d\n",i,j,k,m);
system("pause");
return 0;
}
-2 3 0 1
想請問 k為什麼不是1
--
When we toss a coin , we obtain either head or tail. Now we toss a coin 5
times. There are 2^5 possible outcomes. How many of them contain no two
consecutive heads?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.105.81.75
推 chchwy:關鍵字 short circuit 02/29 21:37
推 purpose:心有靈犀呀 02/29 21:46
推 cisco:同學~ 哈我之前問過!! 興大資工XD 02/29 22:25
→ cisco:可以爬文一下~ 02/29 22:25
→ diabloevagto:不是i就不成立了,怎麼j也會加到? 02/29 22:28
→ diabloevagto:沒事...眼拙= == 02/29 22:29
→ bjk:3QQ 02/29 22:32
推 nininic:因為 A||B , A成立的話~~後面B就不會執行了 02/29 23:07
→ angleevil:看來板友們心情不錯 03/01 09:10
→ xatier:樓上XD 03/01 10:39
→ bjk:可能連假吧XD 03/01 12:08
推 WLTC:的確XD 03/01 18:17