Tuesday, 19 August 2014

Finding Tokens in a String Using Strock

#include
#include
#include

void main()
{
char str[80];
char s[]={' ',',',':',';'};
char *t;

clrscr();
printf("enter value\n");
gets(str);
/* get the first token */
t = strtok(str, s);
printf("token is ::\n");
/* walk through other tokens */
while( t != NULL )
{


printf( " %s\n", t );

t = strtok(NULL, s);
;

}

No comments:

Post a Comment