My program compiles without errors but when i debug my program i get the error message "Unhanded exception at 0x0131175c in test.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd." I have tracked the problem to my array cxP which i think is well initialized. I cant semm to get beyond this. any help. I am using VS 2010. This is not the entire program but a test piece that reproduces the problem in the bigger program. Actually all my 2d arrays are failing for some reason i dont understand.
This line for(int i=1;i<npg;i++){cxP[i]=newint[ngs];}//cxinP[npg][ngs]
starts with 1 (i=1) so the first element remains uninitilized
I's suggest that you don't use 2d arrays but instead 1d and calculating the offset yourself. That might be easier to handle and does not require this enless row of new's
Thank you for pointing that out. I am not so sure I understand the offset suggestion. You see i have to generate a population of random numbers here cxP[ipg][igs]=0 that i use in an optimization process that requires the sorting of the entire population and divinding it into groups that are later handled one by one and when the process is done, must be replaced in the original array.