array[i]++
和 array[i++]
有什么区别,其中数组是一个 int 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
处的元素。
关于c - C 中的数组增量类型 - array[i]++ 与 array[i++],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7595247/