Possible Duplicate:
How can I allocate a 2D array using double pointers?
I used VB 2012 Express to make a maze program.
It works really well even when I set ROW*COLUMN
to 499*499
, (the maze is an array: unsigned char maze[ROW][COLUMN]
).
But one time I tried to make a super-giant maze of999*999
, and the compiler gave me a "stack overflow" error.
I do know what it means, but is there any way to assign extra memory or even use some disk space to run my program?
You are allocating maze
on the stack, and stack size is typically limited to between 1 and 8 megabytes. To overcome this limitation, allocate maze
on the heap.
For suggestions on how to do this, see How can I allocate a 2D array using double pointers? and Heap allocate a 2D array (not array of pointers)