I need a method to compare a multiple tokens from the same string using strtok, I need to compare the first token with the second token and so on, so i tried this, but unfortunately the first loop executes only once.
char s[]="123 456 789"
char *dup1 = strdup(s);
char *dup2 = strdup(s);
for(char* old=strtok(dup1," "); old!=NULL; old=strtok(NULL," ")){
for(char* new=strtok(dup2," "); new!=NULL; new=strtok(NULL, " ")){
strcmp(old, new);
}
dup2=s;
}