Mail Archives: djgpp/1999/10/13/13:50:58
On Sat, 9 Oct 1999, Nicolas Blais wrote:
> ushort pix_x;
> ushort pix_y;
> ushort color_red;
> unsigned int matrix[res_x][res_y] = {{0}};
I probably should have seen this sooner, but the incomplete source
didn't help: you are declaring a large automatic array, and it
overflows the run-time stack. matrix[res_x][res_y] is declared int,
so each element takes 4 bytes. 640*480*4 is *way* more than 512K
bytes, the size of the run-time stack allocated by the startup code.
Section 15.9 of the FAQ describes the two ways you can use to enlarge
the stack. But I suggest to make your matrix either a static array
(outside of any function) or to allocate it at run time by a call to
malloc.
- Raw text -