Hey guys! I hit a slight problem. While I don't get any error on compiling this code, when running the program, I get the "This program has stopped working" error. I have tried putting everything in a try/catch to see if there is any problem, but I got nothing.
Here is the code:
It is not the first time it happens, it happened quite a lot. I am sure it isn't due to my RAM, as on other PCs it throws the same error.
Any help is greatly appreciated!
Thank you in advance!
Best regards,
BrreaKerr.
In your oranise_array function you have multiple errors. Line 43 isn't even legal C++, you have to define arrays with constexpr values, or dynamically allocate on the heap. Also, you do realise that the arrays would be initialized with size 0 anyway, which means that you instantly get a segfault? You should dynamically your arrays with size tam (worst case scenario), and then remember to deallocate at the end of the function. Alternately, you could change to a better algorithm, which doesn't require 2 temporary arrays, such as swapping the elements within the array itself.
I managed to find the problem, I was declaring an array as arr2[0] and arr3[0]. meaning that in the for that follows the program was trying to place values in an array that does not have any dimensions. I explained it here, just in case someone else runs into this problem.
Edit: I forgot to refresh before posting, thank you NT3!