que tal amigos quisiera que me ayudaran a hacer la funcion strtok ya tengo una parte del codigo pero tiene algunos errores no se si me puedan ayudar.
gracias.
#include<stdio.h>
int strlen(char cad[])
{
    char *ptr=cad;
    while(*ptr)
        ptr++;
    return cad-ptr;
}
char* strtok(char cad[], char sep[])
{
    static char *ptr=cad;
    char *ptr2=sep;        
    while(*ptr2)
    {
        while(*ptr)
        {
            if(*ptr==*ptr2)
            {
                *ptr=' ';
                return ++ptr;
            }
        ptr++;
        }
    ptr2++;
    }
return NULL;
}
main()
{
    char cad[94]="mejor morir de pie que vivir arrodillado";
    char sep[9]=" ";
    char *ptr[20];
    int i=0;    
    ptr[0]=strtok(cad,sep);    
    while(*ptr
)
    {
        puts(ptr);
        printf("n");
        ptr=strtok(NULL,sep);    
        ptr[i++];
    }
return 0;    
}
/*me