Hi everybody, I'm having a little problem with some C work I need to take care of. I'm just learning that language, and I want to build a so-called tokenizer, i.e. a program c that reads a char* of text, splits it up into several char* according to certain delimiters (space, comma, question mark, etcetera), and finally assigns a char** as a pointer-reference to the various individual parts.
For example, the input char* "This is just a test!", would be converted into a char** with arrays "This", "is", "just", "a", "test".
Basically this would be the header of the program: char** tokenize (char* input, int* arraylength)
I already have a function "int is_delimiter (char input)" which returns 1 if the char is a delimiter and 0 if it's not.
However I have no idea what to do now. I guess I need to make a for-loop going over every char of my input, but then how do I return a char** that points to the various parts...
Any help would be much appreciated
EDIT: Oh by the way, I'm well aware that there is an in-built function in C to do this for you, but that's not the purpose of the exercise.





Reply With Quote

...is my daddy!






