For example it prints '(night' despite tokenizing (), why does this happen?
char* word = strtok(&c, ",.;()");
while(word!= NULL)
{
word = strtok(NULL, ",.;()");
printf("%s ", &c);
}
For example it prints '(night' despite tokenizing (), why does this happen?
char* word = strtok(&c, ",.;()");
while(word!= NULL)
{
word = strtok(NULL, ",.;()");
printf("%s ", &c);
}
Your code just prints &c
on every iteration (whatever that is). You never print word
, which is your next token. That's why you never see the results of your tokenization. If you want to see the tokens, you have to print word
, not c
.
On top of that it is completely unclear why you are applying &
operator to your c
. If c
is a string pointer or a char array, that &
there makes no sense at all.