gpt4 book ai didi

c - C 中的数组增量类型 - array[i]++ 与 array[i++]

转载 作者:太空狗 更新时间:2023-10-29 16:57:28 27 4
gpt4 key购买 nike

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com