Dear all,
I am wondering if I understand well. In the structure below
Code:
struct chromosome{
double genes[NUM_OF_GENES];
};
struct chromosome old_chrome[NUM_OF_CHROMES],new_chrome[NUM_OF_CHROMES];
old_chrome[NUM_OF_CHROMES] and new_chrome[NUM_OF_CHROMES]
are pointing to two different point in memory where they allocate the space to store their instance of the type chromosome.
Now if I want to copy the elements of the old_chrome to the new_chrome I can redirect the new_chrome to point to the same place in memory as the old_chrome
So far I am doing this in a for loop:
Code:
for (i=0;i<NUM_OF_CHROMES;i++)
{
new_chrome[i]=old_chrome[i];
}
I would be really grateful of any comments on my understanding and moreover If their is a faster way (regarding the process time) to make such a copy.
Thanks for your time in advance,
Chris