What does it mean double free detected in tcache 2 while using mpz?
Your code has undefined behaviour because you are trying to assign l from an uninitialised array str. I’m guessing you got your functions confused and meant to write the opposite That code assigns l to str. Use the following code to work out how big str needs to be