First I used delimiter as space, its working fine. Next, I used delimiter as a (,) comma just after that. But the output is showing only for space delimiter. Here is my code:
char s[100]= “Today is a rainy day”;
char *ptr = strtok(s," ");
cout<<ptr<<endl;
while(ptr!=NULL){
ptr=strtok(NULL," ");
cout<<ptr<<endl;
}
char s1[100]= "Today, is a rainy, day";
char *ptr1 = strtok(s1,",");
cout<<ptr1<<endl;
while(ptr1!=NULL){
ptr1=strtok(NULL,",");
cout<<ptr1<<endl;
}