Function PGASetCharacterAllele

Function Documentation

void PGASetCharacterAllele(PGAContext *ctx, int p, int pop, int i, char val)

Sets the value of an allele in a string of the character data type.

Example

Copies the alleles from member p in PGA_OLDPOP to member q in PGA_NEWPOP. Assumes the strings are of the same length.

PGAContext *ctx;
int p, q, i;
int l;

...
l = PGAGetStringLength (ctx);
for (i=0; i<l; i++) {
    char a = PGAGetCharacterAllele (ctx, p, PGA_OLDPOP, i);
    PGASetCharacterAllele (ctx, q, PGA_NEWPOP, i, a);
}

Parameters
  • ctx – context variable

  • p – string index

  • pop – symbolic constant of the population the string is in

  • i – allele index

  • val – character value to set the allele to

Returns

The allele is changed by side-effect.