I declared an array of 1'000.000 of ints, and my program in C compile perfectly, but when run it, it crashed, why?
can't i use an array with more 1'000.000 of ints or longs?
I use Devcpp to write my programs.
I can't use an array of 1'000.000 of ints?
Moderator: Board moderators
hmm... :-?
Possibly you are declaring the array locally ( ie inside the main() or any other fun() ).
Declaring it as global should solve the problem.
This code will crash.
This one will work.
Declaring it as global should solve the problem.
Code: Select all
int main() {
int large_array[1000000];
}
Code: Select all
int large_array[1000000];
int main() {
}