Your code has too many problems for Ed to cover in detail right now, so here is a simple function that works using the library functions strcspn, strspn, and printf for any heavy lifting. If you cannot use strcspn or strspn, the problem can be broken down into the tasks they perform:
#include <stdio.h>
#include <string.h>
void split(char const *s)
{
while (*s)
{
size_t last = strcspn(s, "-"); // Find the end of the token
printf("Found '%.*s'\n", last, s);
s += last; // Skip the token
s += strspn(s, "-"); // Skip adjacent delimiters
}
}
int main()
{
split("HEllo-le-t-me-confirm-it");
}