csripriya1
Programmer
hi all,
I have some problem with the pointers to objects.I have my program like this.
void chrom_manip(int max_fgs[],int len_chrom)
{
int i,dummy;
chromosome *chrs[6];
chromosome chrdummy;
ran.seedgen();
for(i=0;i<6;i++)
{
chrs=chrdummy.makechrom(max_fgs,len_chrom);
chrs->printchrom();
}
chrs[0]->printchrom();
}
The output I get is like this.
157 379 331 104 1430 163 210 372 67
173 397 270 120 1236 134 216 408 58
173 425 306 109 1240 136 230 396 63
147 453 291 113 1118 177 206 396 78
145 432 296 102 1324 131 242 462 69
178 415 274 100 1347 176 244 421 76
178 415 274 100 1347 176 244 421 76
This gives me an error message about assertion.
My another question is why does this chrs[0] takes the value of chrs[5].
Can anyone please help me with this.
thanks for the help and time.
I have some problem with the pointers to objects.I have my program like this.
void chrom_manip(int max_fgs[],int len_chrom)
{
int i,dummy;
chromosome *chrs[6];
chromosome chrdummy;
ran.seedgen();
for(i=0;i<6;i++)
{
chrs=chrdummy.makechrom(max_fgs,len_chrom);
chrs->printchrom();
}
chrs[0]->printchrom();
}
The output I get is like this.
157 379 331 104 1430 163 210 372 67
173 397 270 120 1236 134 216 408 58
173 425 306 109 1240 136 230 396 63
147 453 291 113 1118 177 206 396 78
145 432 296 102 1324 131 242 462 69
178 415 274 100 1347 176 244 421 76
178 415 274 100 1347 176 244 421 76
This gives me an error message about assertion.
My another question is why does this chrs[0] takes the value of chrs[5].
Can anyone please help me with this.
thanks for the help and time.