i++跟++i的差異

張貼日期:2011/6/21 上午 05:11:26

i=0;

return i++; //得到0

i=0;

return ++i; //得到1

雖然最後i都是1但回傳的時候看++位置決定回傳結果