I have a few issues with in your code:
Consistency in naming - use either camelCase or not_camel_case but don't mix
consistency in braces. The opening brace for a function goes in the first column.
word_start_indexandword_end_indexshould take aconstparameterword_start_indexis the same asstrspn(string, " ");or if you are also looking for punctuation,strspn(string, " \t\n.,;:");word_end_index- as forword_start_indexbut usestrcspn(note the 'c')word_end_indexas a function (ie not in your context) fails for an empty string or a string starting with a space (it returns the char before the string starts).variable
testinmain()is misnamed. I would prefer something that shows it is a string.the test
while (test != '\0')inmain()is wrong - should be*test != '\0'. Your loop always exits from thebreakno return or parameters in main()
Also, arguably the position of the stars in your pointers is wrong. I prefer char* p to be written char *p, which makes it clear that it is p that takes the star. Consider code such as char* a, b;. This is bad because it gives the impression that b is a pointer.