First of all, since you called this C ++, not C, why are you using arrays? Instead, I can suggest vector<double> or, if continuous memory causes deque<double> problems, which loosens the limit on continuous memory without removing the almost constant time lookup.
Using vector or deque can also alleviate other seg crash issues that may affect your project at a later date. For example, the excess limits in your array. If you convert to vector or deque , you can use the member function .at(x) to retrieve and set the values ββin your collection. If you try to write out of bounds, this function will throw an error.
source share