Function PGAGetCharacterAllele

Function Documentation

char PGAGetCharacterAllele(PGAContext *ctx, int p, int pop, int i)

Return the value of character 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

Returns

The value of allele i in string p