With a code where I have a struct:
struct fibo_entry {                 /* Definition of each table entry */
    int n;
    unsigned long long int lli;     /* 64-bit integer */
    char *str;
};
I have to solve a Fibonacci sequence where I have the following:
    fibo_table = (struct fibo_entry *)malloc(sizeof(struct fibo_entry));
    //fibo_table->str = (char *)malloc(1 + 8 * sizeof(char)); // !!??
    for (i = 0; i <= n; i++) {
        fibo_table[i].n = i;
    if (i == 0) {
        fibo_table[i].lli = 0;
        //sprintf(fibo_table[i].str, "%llu", fibo_table[i].lli);
        //fibo_table[i].str = atoi(fibo_table[i].lli);
      
    } else if (i == 1) {
        fibo_table[i].lli = 1;
    } else {
        fibo_table[i].lli = fibo_table[i-1].lli + fibo_table[i-2].lli;
        //log10(fibo_table[i].lli);
    }
}
The process to calculate Fibonacci is done, the problem that I have comes when I have to calculate the memory that I need to allocate a long long int in the string.
I know that the numbers use 64 bits each and I tried with malloc and the concept that sprintf should work to convert one in another, but I can't find a solution. Every time that I try to run the program, just fail.
 
     
     
     
     
    