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


extern void split(char *s, char **w, int z)
{
  int i,v;

  i=0;v=1;
  w[0]=&s[0];
  while((s[i] != '\0') && (v < z))
  {
    if (s[i] == ' ')  /* space */
    {
      s[i] = '\0';  /* split the string */
      i++;
      w[v] = &s[i];
      v++;
      while(s[i] == ' ')  /* bypass all the other spaces if > 1 space */
        i++;
    }
    else
      i++;
  }
  w[v] = NULL;
}
