implement generateNeighborCoordinates in C