segmentation fault
Marco Bodrato
bodrato at ssh2.dm.unipi.it
Thu Jan 13 14:11:33 CET 2011
Hi,
On Mon, Jan 10, 2011 at 07:42:54PM +0530, Nimo s wrote:
> Im new to using gmp library im using mpz_powm () function
> im genreating 1000^10 but its showing segmentation fault
> with fedora 10 and gcc complier how to solve the problem
I'd suggest using mpz_ui_pow_ui (), and reading the manual.
The folowing example compiles and runs smoothly for me.
#include <gmp.h>
void main () {
mpz_t power;
unsigned int base, exponent;
base = 1000;
exponent = 10;
mpz_init (power);
mpz_ui_pow_ui (power, base, exponent);
gmp_printf ("%u ^ %u = %Zd\n", base, exponent, power);
}
I hope this helped,
m
--
http://bodrato.it/papers/
More information about the gmp-discuss
mailing list