Quote Originally Posted by arp35
At first I will have to probably save these sentences dynamically into 2D array with realloc function, but I do not know how to do that if I do not know the length of every sentence nor the number of sentences.
I suggest defining two structures like this:
Code:
struct sentence
{
    double number;
    char *text;
};

struct sentence_list
{
    struct sentence *sentences;
    size_t size;     // number of elements in use
    size_t capacity; // number of elements allocated
};
The idea is to read line by line, either using the non-standard (but POSIX standard) getline, or by defining your own version of getline with fgets in a loop to read the entire line of unknown length. You then parse this line (keeping in mind the colon) to get number and text, with which you then create a struct sentence object and insert it into the struct sentence_list object. If the size is about to exceed the capacity, you realloc the sentences for a new capacity (say 1.5 or 2 times the previous capacity).