problems with structures and mpz_t

Wing Lian wing.lian at usm.edu
Mon Mar 28 00:29:51 CEST 2005


I am trying to use structures containing mpz_t variables so that I can sort
according to certain criteria.

struct individual {
    mpz_t int1, int2;
    unsigned long int int3;
};
..
int n;
n = 10; //number of elements
individual *gen1;
gen1 = (individual *)malloc(sizeof(individual)*n);
for (i=0; i<n; i++) {
	mpz_init(*(gen1 + i).int1);
}
..

when compiled, the error returns 
	error: request for member `int1' in `(gen1 + (+(i * 40)))', which is of
non-class type `individual*'

I'm pretty sure I'm using the correct syntax so I'm not sure what's going on.

Thanks
Wing



More information about the gmp-discuss mailing list