When running the following code using char *strtok(char *str, const char *delim):
int main (void) {
char str[12] = "Hello World";
char *token;
token = strtok(str, " ");
token = strtok(NULL, " ");
return(0);
}
It gives an unwanted error stating:
warning: null passed to a callee that requires a non-null argument [-Wnonnull]
token = strtok(NULL, " ");
~~~~ ^
The issue is that strtok should be able to run a second iteration with a NULL as it's char *str without giving me a warning.
When running the following code using
char *strtok(char *str, const char *delim):It gives an unwanted error stating:
The issue is that
strtokshould be able to run a second iteration with aNULLas it'schar *strwithout giving me a warning.