[Solved] Segmentation fault (core dumped) in C (with GMP lib)
From the little bit of code you have, the difference seems to be the scope of the variable a. What is the point of calling mpz_init(a) on a variable with only local scope (within your init() function)? After init() returns, a disappears. If you need it for anything else later, the variable a, and presumably … Read more