c语言用指针的方法分割英文句子中的单词的问题

如图是我的代码,我是想用两个指针来完成,但是程序运行不起来,希望能有人帮忙解决一下我的问题……

img

img

本人萌新,可能还有语法错误望指点


//输出单词,每个单词占一行
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int main()
{
  
  char str[N];
  gets(str);
  int n = strlen(str);
  for(int i = 0; i < n; i++){
    int j = i;
    while(j < n && str[j] != ' ') j++;
    //问题的具体逻辑
    for(int k = i; k < j; k++){
      cout<<str[k];
    }
    cout<< endl;
    i = j;
  }
  
  return 0;
}

https://blog.csdn.net/weixin_44882124/article/details/123593401?spm=1001.2014.3001.5502

#include<stdio.h>
#include<string.h>
#define max 150    //句子总单词数最大值 
#define lmax 25 //句子单个单词字母总数最大值 
int isc(char t)    //判断一个字符是不是字母
{
    if((t<='z'&&t>='a')||(t<='Z'&&t>='A'))
        return 1;
    else
        return 0;
}
int isw(char t[],int b,int e)//判断字符串从下标b开始到下标e是不是一个单词
{
    int flag=1;
    for(int i=b; i<=e; i++)//下标b开始到下标e,中间有不是字母的,返回
    {
        if(isc(t[i])==0)
        {
            return 0;
        }
    }
    if(b>0)//不是字符串第一个字符
    {
        if(isc(t[b-1])==0&&isc(t[e+1])==0)//下标b-1和下标e+1不是字母,返回
        {
            return 1;
        }
    }
    else
    {
        if(isc(t[e+1])==0)
        {
            return 1;
        }
    }
    
    return 0;
}
void prin(char t[],int b,int e)//打印字符串从下标b开始到下标e之间的内容
{
    for(int i=b; i<=e; i++)
    {
        putchar(t[i]);
    }
    printf("\n");
}
int main()
{
    char t[max]= {' '};
    char wt[max][lmax];
    while(t)
    {
        gets(t);
        int count=0;
        int len=strlen(t);
        int Left=0,Right=0;//左指针Left,右指针Right 
        int p;
        for(Left=0; Left<len; Left++)
        {
            for(Right=0; Right<len-Left; Right++)
            {
                if(isw(t,Left,Left+Right)==1)//判断从左指针到右指针,之间是不是一个单词 
                {
                    prin(t,Left,Left+Right);
                    count ++;
                    break;
                }
            }
        }
        printf("\n");
        printf("单词数:%d\n",count);
        printf("输入quit退出\n");
        if(strcmp(t,"quit")==0)
            break;
    }
    return 0;
}