the following code caused segmentation fault (core dumped) with 1000000000 times loop. but by reducing the looping time to 100000, it goes ok.
so is it causing any thing wrong in cpu, hardware, or anywhere? is it caused by watchdog timer?
can anybody help to explain it for this? what happened when cpu goes to huge loops(finite loops with huge number repeating)? how does cpu tell the computing is infinite? many thanks.
#include <stdio.h>
int main () {
int a[1000000000];
int i = 0;
for (i = 0;i < 1000000000; i++){
if(i % 4 == 0){
a[i] = i;
}else {
a[i] = 321;
}
}
printf("run over");
return 0;
}