C中的数组增量差异 [英] array increment difference in C
本文介绍了C中的数组增量差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是什么数组[我] ++
和数组[我++]
的区别在哪里阵列是一个int 数组[10]
?
解决方案
int类型的[] = {1,2,3,4,5};
INT I = 1;
一个由[i] ++;
的printf(%D \\ n,我,一个[I]);
A [++]
的printf(%D \\ n,我,一个[I]);
输出
1 3
2 3
A [I] ++
递增索引元素 I
,它不会增加 I
。和 A [我++]
递增 I
,而不是指数的元素 I
。
I am wondering what is the difference between array[i]++
and array[i++]
where array is an int array[10]
?
解决方案
int a[] = {1, 2, 3, 4, 5};
int i = 1;
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]++
increments the element at index i
, it doesn't increment i
. And a[i++]
increments i
, not the element at index i
.
这篇关于C中的数组增量差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文