/* * Compile with * * gcc -Wall -o gmp_test gmp_test.c -lgmp */ #include #include #include struct strm { unsigned int i; mpz_t t; }; struct strm *init() { struct strm *s = (struct strm*)malloc(sizeof(struct strm)); mpz_init(s->t); s->i = 0; return s; } int main(int argc, char *argv[]) { struct strm *s = init(); mpz_add_ui(s->t, s->t, 42); gmp_printf("%s is an mpz: %Zd\n", "here", s->t); mpz_clear(s->t); free(s); return 0; }