I am new to c programming language. What I am trying to do is to get store pi in arbitary precision and turn that to string.
int calculatePIConst (int preciznost)
{
//init var
mpfr_t x;
mpfr_init2 (x, preciznost);
//populate pi
mpfr_const_pi (x, MPFR_RNDN);
//turn to string
char abc[preciznost];
int i;
//error RUN FINISHED; Segmentation fault; core dumped; real time: 90ms; user: 0ms; system: 0ms
// mpfr_get_str (abc, i, 50, 50, x, MPFR_RNDN);
//write pi
mpfr_printf ("PI = %1.1024RNf\n", x);
mpfr_clear (x);
return *abc;
}
Here is mpfr lib documentation documentation http://www.mpfr.org/mpfr-current/mpfr.html#Miscellaneous-Functions