C中的数组增量类型-array [i] ++与array [i ++] [英] Array increment types in C - array[i]++ vs array[i++]
本文介绍了C中的数组增量类型-array [i] ++与array [i ++]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
array[i]++
和array[i++]
之间的区别是什么,其中数组是一个整数array[10]
?
What is the difference between array[i]++
and array[i++]
, where the array is an 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
处的元素.
a[i]++
increments the element at index i
, it doesn't increment i
. And a[i++]
increments i
, not the element at index i
.
这篇关于C中的数组增量类型-array [i] ++与array [i ++]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文