数组问题
# include <stdio.h>
int main() {
int i = 0, a[] = { 1,2,3,4,5,6 };
while (1 < 6)
{
if (a[i] % 2 == 0)
a[i] = a[i] + 1;
i++;
}
for (i = 0; i < 6; i++)
printf("%d", a[i]);
}
菜鸟教程 run: line 1: 3 Segmentation fault (core dumped) ./a.out
Exited with error status 139
vs
0x00007FF6763B18C8 处有未经处理的异常(在 Project1.exe 中): 0xC0000005: 读取位置 0x00000083B2D00000 时发生访问冲突。
结果
while (1 < 6) 应该是 while (i < 6),你把i写成1了
抄错了
while (i < 6) 不是 while (1 < 6)