Listing 2

int allocate_space(int nbr, char ***ptrarray, int size, char **string)
   {  //Allocate the array pointers
   if( (*ptrarray = (char **)calloc(nbr,sizeof(char *))) ==NULL)
       return(0);       //Allocate the string space ***
   if( (*string = (char *)calloc(size+1,sizeof(char))) == NULL)
       return(0);
   return(1);
   }

void free_space(char ***ptrarray, char **string)
   {
   free(*ptrarray);
   free(*string);
   }

 void str_to_ptrarray(char *orgstr, char *ptrarray[])
   {
   int i=0;
   char *s;
   s=strtok(orgstr,word_breaks); //Find the first word
   while(*s)
      {
      ptrarray[i]=s;      //assign it
      i++;
      s=strtok(NULL,word_breaks);  //Find the rest of the words
      }
   }

// End of File