I'm having trouble below putting the input from getchar() into a char \*arr[] array. The reason I'm doing this is because the input data, which will be a file with command line arguments, will be stored in an char pointer array to be passed to the execvp function.

I'm using getchar() is so I can later implement a feature which allows the user to press the 'tab' button and try and match a file to the text already typed. 

After executing the below program, I type:
 ls -a (with a trailing space) 

which should obviously run but doesn't, I get a SEG 11 fault. If anyone could point what I'm doing wrong that would be really good!!

Thanks.

```
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>

int main(){

    char *arr[10];
    int l_count = 0, w_count = 0;
    char c;
    char *curLine;
    curLine = (char*)calloc(10, sizeof(char));
    while((c=getchar()) != '\n'){
        if (isspace(c)){
            curLine[l_count]='\0';
            memcpy(arr[w_count],curLine,strlen(curLine));           
            ++w_count;
            l_count=0;
        }       
        else{
            curLine[l_count]=c;
            ++l_count;
        }
    }
    arr[w_count]='\0';

    // Testing
    int i;
    for (i=0;i<2;i++){
        printf("%s, ", arr[i]);
    }
    printf("\n");

    return 0;
}

```