I am trying to create a two dimensional array, which has either 1 or 0 randomly assigned to each coordinate. It works just fine until it gets to the coordinates [20][3]. After t
You're running past the bounds of the array. That's undefined behaviour in C, and is manifesting itself as a crash.
Change i <= x to i < x etc, or increase the grid size.
i <= x
i < x