I have lineget function that returns `char *`(it detects `'\n'`) and `NULL` on `EOF`. 
In `main()` I'm trying to recognize particular words from that line.
I used strtok: 

```
int main(int argc, char **argv)
{
    char *line, *ptr;
    FILE *infile;
    FILE *outfile;
    char **helper = NULL;
    int strtoks = 0;
    void *temp;

    infile=fopen(argv[1],"r");
    outfile=fopen(argv[2],"w");

    while(((line=readline(infile))!=NULL))
    {
        ptr = strtok(line, " ");

        temp = realloc(helper, (strtoks)*sizeof(char *));
        if(temp == NULL) {
            printf("Bad alloc error\n");
            free(helper);
            return 0;
        } else {
            helper=temp;
        }
        while (ptr != NULL) {
            strtoks++;
            fputs(ptr, outfile);
            fputc(' ', outfile);
            ptr = strtok(NULL, " ");
            helper[strtoks-1] = ptr;
        }
        /*fputs(line, outfile);*/
        free(line);
    }
    fclose(infile);
    fclose(outfile);
    return 0;
}

```

Now I have no idea how to put every of tokenized words into an array (I created `char ** helper` for that purpose), so that it can be used in `qsort` like `qsort(helper, strtoks, sizeof(char*), compare_string);`. 

Ad. 2 Even if it would work - I don't know how to clear that line, and proceed to sorting next one. How to do that? 

I even crashed valgrind (with the code presented above) -> "valgrind: the 'impossible' happened:
 Killed by fatal signal"

Where is the mistake ?