Use static keyword:
Without doing it, it goes to the heap, which is limited in size by
the linker (can be something like 1 megabyte) and is not suitable for
storing large variables.
Be aware that your function is no more reentrant after that.
or
Assign Dynamic allocation to array:
or something similar. or use the fancy "new" keyword in C++.
(for those who say malloc is not C++ enough, that may be true, but it's still functional)
Code:
static int i[2000][2000];
Be aware that your function is no more reentrant after that.
or
Assign Dynamic allocation to array:
Code:
int **array=malloc(2000*2000*sizeof(int));
(for those who say malloc is not C++ enough, that may be true, but it's still functional)
No comments:
Post a Comment