Parse line function handler:
char **parse_line(char *input) {
    char **tokens;
    char *token;
    char *seps = " \n";
    token = strtok(input, seps);
    int i = 0;
    while (token != NULL) {
        tokens[i] = token;
        i++;
        token = strtok(NULL, seps);
    }
    tokens[i] = NULL;
    return tokens;
}
Pipe function handler:
void pipes(char *input) {
    const char ch = '|';
    printf("%s", input);
    char *c;
    if (strchr(input, ch) == NULL) {
        printf("no | found\n");
        return;
    }
    printf("%s\n", input);
    char *p = strtok(input, "|");
    int i = 0;
    char *array0;
    char *array1;
    while (p != NULL) {
        if (i == 0)
            array0 = p;
        else
            array1 = p;
        i++;
        printf("p: %s\n", p);
        p = strtok( NULL, "|" );
    }
    printf("opening\n");
    parse_line(array1);
}
Main
int main(int argc, const char *argv[]) {
    while (1) {
        printf("> ");
        //read line
        char input[100];
        fgets(input, sizeof(input), stdin);
        pipes(input);
    }
    ...
gdb output:
(gdb) cat scores | grep villanova
Undefined catch command: "scores | grep villanova".  Try "help catch".
(gdb) run
Starting program: ******* 
> cat scores | grep villanova
cat scores | grep villanova
cat scores | grep villanova
while
while
opening
 grep villanova
Program received signal SIGSEGV, Segmentation fault.
0x00007fffffffddf2 in ?? ()
(gdb) x/s 0x00007fffffffddf2
0x7fffffffddf2: "villanova"
(gdb) p $_siginfo._sifields._sigfault.si_addr
$1 = (void *) 0x7fffffffddf2
(gdb) q
When stepping through with gdb it seg faults after it reaches the end of the pipes function. Anyone have any idea why/ how I can find out why and fix it. 
I'm trying to get better at debugging but this has stumped me and I'd appreciate any help I can get :)
 
    