Split string in C language is quite easy. It is possible to split the string in many ways. Using strtok we can very easily tokenize the string using a delimiter.
#include <stdio.h>
#include <string.h>
void main()
{
char s[] = "WEB,EKO,TKO";
for (char *p = strtok(s,","); p != NULL; p = strtok(NULL, ","))
{
printf("%s\n",p);
}
}
This links provides the explanation about it.
#include <stdio.h>
#include <string.h>
void main()
{
char s[] = "WEB,EKO,TKO";
for (char *p = strtok(s,","); p != NULL; p = strtok(NULL, ","))
{
printf("%s\n",p);
}
}
This links provides the explanation about it.
Comments
Post a Comment