问题描述
array[i]++
和array[i++]
之间的区别是什么,其中数组是一个整数array[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]);
输出
1 3
2 3
a[i]++
递增索引i
处的元素,而不递增i
.并且a[i++]
递增i
,而不是索引i
处的元素.