I have the following code in C:
int i = 0;
char delims[] = " \n";
char *result = NULL;
char * results[10];
result = strtok( cmdStr, delims );
while( result != NULL )
{
results[i] = result;
i++;
result = strtok(NULL, " \n");
}
if(!results[1])
{
printf("Please insert the second parameter...\n");
}
else
{
...
}
It always executes the else
condition even if the results[1]
is empty.
I've tried with results[1] == NULL
but no success.
How do I can check if it is empty or not?