Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to split string into words c++

#include <string.h>

int main ()
{
  char str[] ="This is a sample string";
  char *p;
  
  p=strtok(str," ");
  while (p!= NULL)
  {
    cout<<p;
    p=strtok(NULL," ");
  }
  return 0;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #split #string #words
ADD COMMENT
Topic
Name
6+8 =