这个怎么弄 实在是不懂

img

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

#define N 256

void ReverseSentence(const char str[], char ans[])
{
    int n = strlen(str);
    const char *p = str + n - 1;
    char *q = ans;
    while (p >= str)
    {
        if (isspace(*p))
        {
            do
            {
                p--;
            } while (isspace(*p) && p >= str);
            if (q != ans)
                *q++ = ' ';
        }
        else
        {
            const char *last = p + 1;
            do
            {
                p--;
            } while (!isspace(*p) && p >= str);
            const char *first = p + 1;
            while (first != last)
                *q++ = *first++;
        }
    }
    *q = '\0';
}

int main()
{
    char str[N], ans[N];
    fgets(str, N, stdin);
    ReverseSentence(str, ans);
    printf("%s\n", ans);
    return 0;
}