1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char *str = strdup("Hello World"), *tkn; printf("str [%s@%p]\n", str, str); tkn = strsep(&str, " "); printf("tkn [%s] str [%s@%p]\n", tkn, str, str); free(str); return 0; }