[C / C ]The function strtok cut strings – function strtok in string

The function strtok(s1, s2) returns after the first string s1 cut by the characters in the string s2.
President s1 = “nguyen, of quan” and we use: char *p = strtok(s1,”, “) (surgical marks and spaces) p is the string: nguyen. If you want to cut to the string, we use strtok(NULL,s2) While it will cut the original string starting position that was previously stopped.
I used to do math: input 1 strings, then write that counteracts the words in the string entered (words do not contain commas, dots, how to play) and one per 1 current

	
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
int main()
{
        int index = 0;
        int i;
        char *a = (char *)malloc(100*sizeof(char));
        char **b = (char **)malloc(100*sizeof(char));;
        printf ("Nhap vao chuoi can dao nguoc: ");
        fflush(stdin);
        gets(a);
 
        char *p;
        p = strtok(a, ",. "); //cat chuoi bang cac ky tu ,. va space
        while(p != NULL)
        {
                b[index] = p;
                index++;
                p = strtok(NULL, ",. "); //cat chuoi tu vi tri dung lai truoc do
        }
        for (i = index-1; i>=0; i--) //in ra cac tu theo thu tu dao nguoc
                printf ("\n%s ", b[i]);
        printf ("\n");

        return 0;
}