Memory allocation problem!

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Sun Sep 4 00:24:49 CEST 2011


Ciao,

Il Sab, 3 Settembre 2011 11:42 pm, laojiang ha scritto:
> Hi, I have a problem,such as I definite a one dimension array, and

>  f_f0= ( mpf_t *)malloc(n0 * sizeof( mpf_t *));

>   for (n = 0; n < n0+1; n++)
>     {
>       mpf_init(f_f0[n]);
>      }

You allocate memory for n0 pointers, then you use n0+1 of them...
This error is not related to GMP in any way, it will fail the same way if
you replace mpf_t with double.

-- 
http://bodrato.it/



More information about the gmp-discuss mailing list