char*** code not working correctly
<p>I need to solve this exercise this way because the given function needs to have these parameters, the problem is I'm getting core dumped at around the 20th string I read:</p>

<pre><code>int load(char *filename, char ***words) {
    char **pt = (*words);
    *words = (char **)malloc(sizeof(char*));
    char s[50];

    FILE *f = fopen(filename, "r");
    int i = 0, t;

    while (fscanf(f, "%s", s) == 1) {
        t = strlen(s);
        printf("%d    ", t);
        s[t] = '\0';

        pt = (char **)realloc(pt, sizeof(char*) * (i + 1));
        pt[i] = (char *)realloc(pt[i], sizeof(char) * (t + 1));

        strncpy(pt[i], s, t + 1);
        printf("%s\n", pt[i]);

        i++;
    }
    return 0;
}
</code></pre>

<p>I'm using pt as a <code>char**</code> just to test how this works, the objective is to store in the <code>***words</code> the strings in the textfile:</p>

<p>textfile:</p>

<pre><code>break
int
case
long
char
continue
return
default
short
do
sizeof
double
static
else
struct
switch
typedef
float
for
unsigned 
goto
while
</code></pre>