Big Arrays

Emanuele Laface ema at scumm.it
Sat Jun 11 17:14:56 CEST 2005


I'm sorry to post this question here but I looked for some hours on google
and I didn't find the reply to my problem.

I would create a "big" vector of mpz_t.
I try to explain with an example:

unsigned int SIZE;
mpz_t *array;
SIZE=100;
array=(mpz_t *)malloc(SIZE*sizeof(mpz_t);

This structure create an array of 100 mpz_t elements, and all it's ok.
But what can I do if I need a SIZE that is a mpz_t instead of unsigned
int?

Could be good something like this:

mpz_t SIZE;
mpz_t *array;
...
initialization of SIZE
...
array=(mpz_t *)malloc(mpz_size(SIZE)*sizeof(mpz_t);

And, if it's ok, how can I manage pointer?
Are legals the commons pointer operations like: ++*array

Please help me.
Thank you.
Emanuele



More information about the gmp-discuss mailing list