I am counting tokens in a tokenized string. I am not sure if it is MinGW or if I need a better compiler but no matter what I try, it crashes and has been crashing unless I am very careful to nurse and ginger it along compiling and running my program.
Essentially I am doing the following:
tokens is a pointer to tokens obtained through strtok on a string.
I know I can pull the tokens out using *(tokens++). I can pull each token out character by character using that. however, when I try to do this in either of 2 ways -
Code:
while (tokens != NULL)
{
printf("%c", *(tokens));
CRASH!
How about -
Code:
switch (*(tokens))
{
case ' ':
count++;
break;
...
}
CRASH!!
I have tried various ways to count the tokens in "tokens" and all have resulted in the exe crashing.
Any help is appreciated.