sir i had tried two ways but both are not working ,what is the problem in doing it.
int main()
{
char s[]=“hi, i am using the, coding blocks course, that is C++”;
char *ch[10];
char t[10];
int i=0;
ch[i++]=strtok(s," ,");
//cout<<*ch;
while(ch!=NULL)
{
ch[i++]=strtok(NULL," ,");
}
for(int i=0;i<5;i++)
cout<<ch[i]<<endl;
}
//way 2:
char s[]=“hi, i am using the, coding blocks course, that is C++”;
char *ch;
char t[10];
int i=0;
ch=strtok(s," ,");
//cout<<*ch;
while(ch!=NULL)
{ cout<<ch<<endl;
t[i]=ch;
i++;
ch=strtok(NULL," ,");
}
for(int i=0;i<strlen(s);i++)
cout<<t[i]<<endl;