I’m getting an error on the second while loop “invalid pointer operation” i thinking its because of the len but i need it to be a pointer so i can address this back. Any suggestions on how to fix this error?
char* getWord(char* string, short* len)
{
size_t walker = 0;
/*POINT TO THE FIRST CHAR*/
while (string[walker] == ' ' || string[walker] == '\0')
++walker;
while ( string[walker + len] != ' ' || string[walker + len] != '\0' )
++len;
return (string[walker]);
Deference it:
but first make sure it is initialized…
Also, you need to return the pointer to the word, not the char at this address, so write:
instead of