C语言分隔字符串

C语言分隔字符串

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

main(){

    char str[] = "now # is the time";
    char delims[] = " ";
    char *result = NULL;
    result = strtok( str, delims );
    while( result != NULL ) {
        printf( "result is \"%s\"\n", result );
        result = strtok( NULL, delims );
    }

}