📜  字符串按空格分割 c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:57.633000             🧑  作者: Mango

代码示例2
// Extract the first token
char * token = strtok(string, " ");
// loop through the string to extract all other tokens
while( token != NULL ) {
  printf( " %s\n", token ); //printing each token
  token = strtok(NULL, " ");
}
return 0;