I'm writing a program where it takes a command line then parse it ,in order to print an Array of strings of each argv in the input .

The code give me a segmentation fault (core dumped) !

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

char  **parse(int position ,char *argv[]  ) ;
int main(int argc ,char *argv[])
 {

    int i=1;
    int f=argc;
    argc--;
    while( i<f) 
   {
     char commands[10];
     char **argument=parse(argc,argv);
     //parse(i ,argv ,commands ,argument) ;
     printf("the argument[ %i ] is :%s \n",i,argument[i]);

     argc-- ;
     i++;
   }
  }

char **parse(int position ,char *argv[])
 {  
   // char *commands;
    char** arguments;
    char *result ;
    char buffer [30] ;
    int count =0;

    arguments = calloc(1, sizeof (char *));

    strcpy(buffer,argv[position-1]); //copy the current argv to the buffer

    result =strtok(buffer," ");
   // strcpy(commands,result); 
    //result =strtok(buffer," ");
    while(result !=NULL )
      {

        arguments[count] =result ;
        ++count;
        arguments = realloc(arguments, sizeof (char *) * (count + 1));            
        result=strtok(NULL," ");
      }
   arguments[count] = NULL; //in order to call the execvp 

   return arguments;

  } 

```

Thank you for help .