Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Program Discussion :: Basics

Home > Programs > Basics

4 / 248

Write your own strtok program in c.

Answer:

#include 
#include 
int main()
{
    char str[] = "qqq44in-tttterv-vviieew-www...-...com-mm";
    strtoken(str,'-');
    //printf("%s",str);
    return 0;
}

void strtoken(char *x, char c)
{
    char *y = x;
    int i = 0, n = 0;
    while (*x != '\0')
    {
        if (*x == c)
        {
            print(y,x);
            y = x+1;
        }
        x++;
        
    }
}
print(char *x, char *y)
{
while (x

Asked In :: HCL Technologies

Post Your Answer Here:

Language:

Post Your Reply Here: