有什么区别array[i]++
(增加括号外)和array[i++]
(括号内递增),其中数组是 intarray[10]
?
int a[] = {1, 2, 3, 4, 5};
int i = 1; // Second index number of the array a[]
a[i]++;
printf("%d %d\n", i, a[i]);
a[i++];
printf("%d %d\n", i, a[i]);
Output
1 3
2 3
a[i]++
增加索引处的元素i
,它不增加i
. And a[i++]
增量i
,不是索引处的元素i
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)