[Solved] Im not sure how to use strtok to separate tokens [duplicate]


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

int main(void) {
    char *order[] = {"Day", "Month", "Date", "Year", "Hour", "Minute", "Second"};
    char text[]  = "Saturday, July 8, 2017, 22:14:10";

    char* delims = " ,:";
    char* token = strtok(text, delims);
    char** label = order;

    while(token)
    {
        printf("%-8s: %s\n", *label, token);
        token = strtok(NULL, delims);
        label++;
    }

    return 0;
}

Output:

Success #stdin #stdout 0s 4176KB
Day     : Saturday
Month   : July
Date    : 8
Year    : 2017
Hour    : 22
Minute  : 14
Second  : 10

2

solved Im not sure how to use strtok to separate tokens [duplicate]