#include<stdio.h> //经典bug
int main()
{
int i = 0;
int arr[10] = {1,2,3,4,5,6,7,8,9,10};
for (i = 0; i < 12; i++) //越界访问
{
arr[i] = 0;
printf("hehe\n");
}
return 0;
}
注:输出结果为死循环
#include<stdio.h> //经典bug
int main()
{
int i = 0;
int arr[10] = {1,2,3,4,5,6,7,8,9,10};
for (i = 0; i < 12; i++) //越界访问
{
arr[i] = 0;
printf("hehe\n");
}
return 0;
}
注:输出结果为死循环