I'm very new to c and need to split a char* of "/w/x:y////z" by "/" or ":" into an array of char so would get an output of "", "w", "x", "y","", "", "", "", "z", NULL
int i;
int j;
int len = strlen(self);
int l = strlen(delim);
int cont;
int count = 0;
char* self = {"/w/x:y////z"};
char* delim = {"/:"};
for (j = 0; j < l; j++) {
for (i = 0; i < len; i++) {
if (self[i] == delim[j]) {
count +=1;
}
}
}
count += 1;
So far I have worked out how many characters need to be removed and I know I need to use strtok.
Any help would be much appreciated! Thank you in advance :)