[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Basics

Home > Programs > Basics

213 / 279

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: