This simple program crash when I compile and run it on Windows with Visual C++:
#include <stdio.h>
void foo()
{
printf("function begin\n");
int n[1000000];
for(long int i = 0; i < 1000000; i++)
{
n[i] = 2;
}
printf("function end\n");
}
int main()
{
printf("hello\n");
foo();
printf("end of the program\n");
}
I compile with cl bug.c
.
In this case, the console only displays:
C:\Users\senss\Desktop>bug
hello
However, when I change the 1 000 000 value to 100 000, there is no problem :
C:\Users\senss\Desktop>bug
hello
function begin
function end
end of the program
Thank you!