bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Doubts: I wish you could help me


From: MFRC
Subject: Doubts: I wish you could help me
Date: Tue, 20 Nov 2001 22:31:47 -0200

Hi,

I am a Brasilian student and I need some instructions about the gmp library.

1. First of all, I would be very thankfull if you could explain to me how I can build a function that makes any arithmetical operation and returns an mpz_t type value.

Ok, I know there are several functions already built but they return a void type.

Then, I tried this way:

mpz_t mpzAdd(mpz_t a, mpz_t b)
{
mpz_t p;
mpz_init (p);
mpz_add (p, a, b);
return p;
}

But it did not work.

Here is the information given by the compiler:

address@hidden gmp-3.1.1]# gcc -g example.c -lgmp
example.c:7: `mpzAdd' declared as function returning an array
example.c: In function `mpzAdd':
example.c:11: warning: return makes integer from pointer without a cast
example.c:11: warning: function returns address of local variable


2. Aditionally, if I define an mpz_t type in a typedef, or in a union, or in a struct, when will I initialize the variable?

Those are my doubts. I thank you.

Rodrigo.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]