USE OF STRTOK FUNCTION



#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
                char c[]="SKN Sinhgad College of Engineeering";
                clrscr();
                char *s1,*s2,*s3,*s4,*s5;
                s1=strtok(c," ");
                printf("%s\n",s1);
                s2=strtok(NULL," ");
                printf("%s\n",s2);
                s3=strtok(NULL," ");
                printf("%s\n",s3);
                s4=strtok(NULL," ");
                printf("%s\n",s4);
                s5=strtok(NULL," ");
                printf("%s\n",s5);

                getch();
}

Comments

  1. // program for string token
    #include
    #include
    void main()
    {
    char s1[10]="pandharpur";
    const char s2[] ="a ";
    char *s3,*s4;
    clrscr();
    s3=strtok(s1,s2);
    printf("\n\t %s",s3);
    s4=strtok(NULL,s2);
    printf("\n\t %s",s4);
    getch();
    }

    ReplyDelete
  2. #include
    #include
    #include


    void main()
    {
    char s1[80];
    char s2[20];
    char *s3;
    clrscr();
    printf("Enter the string\n");
    scanf("%s",s1);
    printf("\nEnter character\n");
    scanf("%s",s2);
    s3=strtok(s1,s2);

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

    s3=strtok(NULL,s2);
    printf("\n%s",s3);

    getch();
    }

    ReplyDelete
  3. //String token
    #include
    #include
    #include
    void main()
    {
    char a[50];
    const char b[50];
    char *c, *d;
    clrscr();
    printf("\n\tEnter a string");
    scanf("%s",a);
    printf("\n\tEnter position");
    scanf("%s",b);
    c=strtok(a,b);
    printf("\n %s",c);
    d=strtok(NULL,b);
    printf("\n %s",d);
    getch();

    }

    ReplyDelete
  4. //String Token
    #include
    #include
    #include
    void main()
    {
    char a[10];
    const char b[10];
    char *c,*d;
    clrscr();
    printf("\n\t Enter the string:");
    scanf("%s",a);
    printf("\n\tEnter position:");
    scanf("%s",b);
    c=strtok(a,b);
    printf("\n\t %s",c);
    d=strtok(NULL,b);
    printf("\n\t %s",d);
    getch();
    }

    ReplyDelete
  5. #include
    #include
    void main()
    {
    char s1[60]="SKNSCOE";
    const char s2[]="s";
    char *s3;
    s3=strtok(s1,s2);
    printf("\n %s",s3);
    s3=strtok(NULL,s2);
    printf("\n %s",s3);
    getch();
    }

    ReplyDelete
  6. #include
    #include
    #include
    void main()
    {
    char s1[50];
    const char s2[50]=" ";
    char *s3;
    printf("\nenter string");
    scanf("%s",s1);
    printf("\nenter character");
    scanf("%s",s2);
    s3=strtok(s1,s2);
    printf("%s",s3);
    s3=strtok(NULL,s2);
    printf("%s",s3);
    getch();
    }

    ReplyDelete
  7. //String token
    #include
    #include
    #include
    void main()
    {
    char a[50];
    const char b[100];
    char *z, *x;
    clrscr();
    printf("\n\tEnter a string");
    scanf("%s",a);
    printf("\n\tEnter position");
    scanf("%s",b);
    c=strtok(a,b);
    printf("\n %s",z);
    d=strtok(NULL,b);
    printf("\n %s",x);
    getch();
    }

    ReplyDelete
  8. // String Token
    #include
    #include
    void main()
    {
    char p[50];
    char q[50];
    char *r, *s;
    printf("\n\tEnter a string");
    scanf("%s",p);
    printf("\n\tEnter character");
    scanf("%s",q);
    r=strtok(p,q);
    printf("\n %s",r);
    s=strtok(NULL,q);
    printf("\n %s",s);
    }

    ReplyDelete
  9. /* Program of string token*/
    #include
    #include
    #include
    void main()
    {
    char x[15];
    char y[15];
    char *s,*n;

    printf("\n Enter The String =");
    scanf("%s",x);

    printf("\n Enter The Position =");
    scanf("%s",y);

    s=strtok(x,y);
    printf("\n%s",s);

    n=strtok(NULL,y);
    printf("\n %s",n);
    }

    ReplyDelete
  10. #include
    #include
    void main()

    {

    char a1[10];
    char a2[2];
    char *a3,*a4;

    printf("enter the string");
    scanf("%s",a1);

    printf("enter the char");
    scanf("%s",a2);

    a3=strtok(a1,a2);
    printf("%s",a3);

    a4=strtok(NULL,a2);
    printf("NULL %s=",a4);

    }

    ReplyDelete
  11. #include
    #include
    #include
    int main()
    {
    char x[15];
    char y[15];
    char *s,*n;

    printf("\n Enter The String =");
    scanf("%s",x);

    printf("\n Enter The Position =");
    scanf("%s",y);

    s=strtok(x,y);
    printf("\n%s",s);

    n=strtok(NULL,y);
    printf("\n %s",n);
    return 0;
    }

    ReplyDelete

  12. #include
    #include
    #include
    void main()
    {
    char c[]=" COMPUTER SCIENCE AND ENGINEERING";
    clrscr();
    char *s1,*s2,*s3,*s4,*s5;
    s1=strtok(c," ");
    printf("%s\n",s1);
    s2=strtok(NULL," ");
    printf("%s\n",s2);
    s3=strtok(NULL," ");
    printf("%s\n",s3);
    s4=strtok(NULL," ");
    printf("%s\n",s4);
    s5=strtok(NULL," ");
    printf("%s\n",s5);

    getch();
    }

    ReplyDelete
  13. #include
    #include
    #include
    void main()
    {
    char c[]="MOVE AREG , A";

    char *s1,*s2,*s3,*s4;
    s1=strtok(c," ");
    printf("%s\n",s1);
    s2=strtok(NULL," ");
    printf("%s\n",s2);
    s3=strtok(NULL," ");
    printf("%s\n",s3);
    s4=strtok(NULL," ");
    printf("%s\n",s4);


    }

    ReplyDelete
  14. #include
    #include
    #include
    void main()
    {
    char c[]="MOVE AREG , A";

    char *s1,*s2,*s3,*s4;
    s1=strtok(c," ");
    printf("%s\n",s1);
    s2=strtok(NULL," ");
    printf("%s\n",s2);
    s3=strtok(NULL," ");
    printf("%s\n",s3);
    s4=strtok(NULL," ");
    printf("%s\n",s4);


    }

    ReplyDelete
  15. #include
    #include
    #include
    void main()
    {
    char c[]="SKN SCOE KORTI PANDHARPUR";
    clrscr();
    char *s1,*s2,*s3,*s4,*s5;
    s1=strtok(c," ");
    printf("%s\n",s1);
    s2=strtok(NULL," ");
    printf("%s\n",s2);
    s3=strtok(NULL," ");
    printf("%s\n",s3);
    s4=strtok(NULL," ");
    printf("%s\n",s4);
    s5=strtok(NULL," ");
    printf("%s\n",s5);

    getch();
    }

    ReplyDelete

Post a Comment