I do not know specifically where the error is so I apologise for posting the whole code in this post.
About one month after starting to learn c++ i decided to make a genetic algorithm for curve fitting a set on points. It was working perfectly fine and as shown in this picture the mean difference of points from their function is show clearly.
(screenshot)https://gyazo.com/25332cf70258788b9cc0189b31533b17
i am sure this is the reason because it will work fine and then when i put declare this new variable at any line in the code and i will get the same error. it can be called anything and contain any value so here i am thinking that i have reached some sort of 'cap'.
can anyone help me out?
useful info (maybe):
Windows 7
CodeBlocks
No compile error
Although your code seems to compile without errors, it does seem to have some warnings:
1 2 3 4 5
main.cpp||In function ‘int main()’:|
main.cpp|93|warning: variable length array ‘Points’ is used [-Wvla]|
main.cpp|99|warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]|
main.cpp|100|warning: variable length array ‘Parents’ is used [-Wvla]|
main.cpp|172|warning: unused variable ‘newtestinteger’ [-Wunused-variable]|
VLA (Variable Length Arrays) are not valid standard C++ and should not be used. Arrays in C++ should be compile times constants. The following:
1 2 3 4 5
usingnamespace std;
int NumberOfPoints= 5;
int NumberOfFunctions = 6;
int PolynomialDegree = 2;
Should probably be const qualified values, this should solve the VLA issues, since these variables seem to be used to size the arrays.
And really you should consider using std::vector instead of the arrays.