I am trying to generate a two-dimensional array of a struct, but this results in the program not launching. The window freezes and the program quits after a few
If I got your snippet right way, you're trying to create an array. Allocation of the array is stack-based, with more than 2 Mb size required. There may be a chance that your stack has less than that 2Mb available, thus the code crashes right at the moment you're entering the function.
Try to allocate the same array dinamically.