问题
填空题
设变量已正确定义为整型,则表达式n=i=2,++i,i++的值为______。
答案
参考答案:C
解析: 题目中的表达式为逗号表达式,其运算顺序为从左到右,最后一个表达式的值为该逗号表达式的值。先执行n=i=2,得i=2;然后执行++i,得i=3;最后执行i++,此时表达式先取i的值为3,然后进行加1运算,i的值为4。
设变量已正确定义为整型,则表达式n=i=2,++i,i++的值为______。
参考答案:C
解析: 题目中的表达式为逗号表达式,其运算顺序为从左到右,最后一个表达式的值为该逗号表达式的值。先执行n=i=2,得i=2;然后执行++i,得i=3;最后执行i++,此时表达式先取i的值为3,然后进行加1运算,i的值为4。
阅读小天地。根据表格内容判断下列句子的正(√)误(×)。 | ||||||||||||||||||
Mary and Kate are friends. They just had a physical examination (体检). These are some of the results (结果).
( ) 2. Kate is older than Mary. ( ) 3. Mary has long and brown hair. ( ) 4. Mary is 10kg heavier than Kate. ( ) 5. Their eyes' colour is the same. |