Почему ошибка сегментации (ядро выгружено) относится к моей программе на C?

Я продолжаю получать эту ошибку, и я не уверен, как это относится к моей программе. Это моя программа.

#include<stdio.h>
#include<stdlib.h>

int nextword(char *str);



void main(void)
{
  char *str = "Hello! Today is a beautiful day!!\t\n";
  int i = nextword(str);
  while(i != -1)
    {
      printf("%s\n",&(str[i]));
      i = nextword(NULL);
    }
}

int nextword(char *str)
{
  // create two static variables - these stay around across calls
  static char *s;
  static int nextindex;
  int thisindex;
  // reset the static variables
  if (str != NULL)
    {
      s = str;
      thisindex = 0;
      // TODO:  advance this index past any leading spaces
      while (s[thisindex]=='\n' || s[thisindex]=='\t' || s[thisindex]==' '                )
    thisindex++;  

    }
  else
    {
      // set the return value to be the nextindex
      thisindex = nextindex;
    }
  // if we aren't done with the string...
  if (thisindex != -1)
    {
      nextindex = thisindex;
      // TODO: two things
      // 1: place a '\0' after the current word
      // 2: advance nextindex to the beginning
      // of the next word
      while (s[nextindex] != ' ' || s[nextindex] != '\n' || s[nextindex] != '\t')
    {
      if ( s[nextindex] == '\0')
        return -1;
      else
        {
          nextindex++;
          if (s[nextindex]==' '||s[nextindex]=='\n'||s[nextindex]=='\t')
        str[nextindex]='\0';
        }
    }

    }
  return thisindex;
}

Моя программа должна иметь вывод на консоль

Hello!
Today
is 
a
beautiful 
day!!

Ответы на вопрос(3)

Ваш ответ на вопрос