To add to @raven-worx, how are you allocating that array ? Because 3000 * 3000 * sizeof(int) might be 36MB depending on your architecture which is not something you can get on the stack with most systems defaults.

To @SGaist and @raven-worx I might horribly wrong but I thought that if it was an insufficient memory problem, the error would be stack overflow or uncaught exception (bad_alloc) not segmentation fault

To @SGaist and @raven-worx I might horribly wrong but I thought that if it was an insufficient memory problem, the error would be stack overflow or uncaught exception (bad_alloc) not segmentation fault

To add to @raven-worx, how are you allocating that array ? Because 3000 * 3000 * sizeof(int) might be 36MB depending on your architecture which is not something you can get on the stack with most systems defaults.