I'm trying to tokenize a sentence into words separated only by single space.
I need to get words from the sentence and then write them onto subscribed array.
Here is my work:

```
void writeToStrArrayOneByOne(char words[10][20], char *sentence){

       char *tokenPtr;
       int j = 0;
       int a,i;
       tokenPtr = strtok(sentence," ");

       while(tokenPtr != NULL){

          a = strlen(tokenPtr);

          for(i=0;i<a;i++){

                words[j][i] = tokenPtr[i];
          }
          tokenPtr = strtok(NULL," ");
          j++;

       }

```

And I call the function with only this in order to debug from main :

```
     char words[10][20];
     char *sentence = "this is a token";
     writeToStrArrayOneByOne(words,sentence);

```

However it freezes like when it does when it's EOF exception.
Appreciate any help, thanks.