【发布时间】:2018-01-20 09:42:18
【问题描述】:
当我对以下代码进行一些小改动时,我注意到了一些差异:
#include<stdio.h>
int main()
{
int arrow;
printf("%d\n", arrow);
int wheel[12]={17, 38, 23, 17, 19, 41, 13, 17, 12, 11, 15, 23};
int initialValue = wheel[arrow];
printf("%d\n", initialValue);
arrow = (arrow + 1) % 12;
printf("%d\n", arrow);
}
当我擦除最后两行时,箭头的初始值为 1,它对应于数组中的值“38”。但是,在完整的代码中,箭头的初始值变为 0,它指向数组中的值 '17'。我想知道为什么会这样?
非常感谢!
【问题讨论】:
标签: c