C程式問題 - 考試
By Vanessa
at 2013-01-03T19:02
at 2013-01-03T19:02
Table of Contents
#include<stdio.h>
int x=0;
int main(){
int y=0;
printf("%d %d %d %d\n",x+1,x++,x+1,x);
printf("%d %d %d %d\n",y+1,y++,y+1,y);
return 0;
}
用gcc編譯,以上會輸出
2 0 1 0
2 0 1 1
(^這個)
我知道是從右至左執行,
但是x和y為什麼最後一個輸出會不一樣呢?
--
int x=0;
int main(){
int y=0;
printf("%d %d %d %d\n",x+1,x++,x+1,x);
printf("%d %d %d %d\n",y+1,y++,y+1,y);
return 0;
}
用gcc編譯,以上會輸出
2 0 1 0
2 0 1 1
(^這個)
我知道是從右至左執行,
但是x和y為什麼最後一個輸出會不一樣呢?
--
Tags:
考試
All Comments
By Quintina
at 2013-01-05T21:57
at 2013-01-05T21:57
By Candice
at 2013-01-07T00:33
at 2013-01-07T00:33
By Cara
at 2013-01-08T05:48
at 2013-01-08T05:48
By Zanna
at 2013-01-11T08:11
at 2013-01-11T08:11
Related Posts
民法上的受僱人
By John
at 2013-01-03T17:17
at 2013-01-03T17:17
基本電學 問題..
By Candice
at 2013-01-03T16:58
at 2013-01-03T16:58
有關於各國人事考科一問
By Andrew
at 2013-01-03T16:25
at 2013-01-03T16:25
優退470人 組改未爆退休潮
By Elma
at 2013-01-03T16:06
at 2013-01-03T16:06
雇員轉公務員 黃三桂表希望
By Odelette
at 2013-01-03T16:01
at 2013-01-03T16:01