[Solved] compare first word of a string array with a string in c


strtok is ok for this and you should do something like:

#include <string.h>

int i = 0;
char *token;
int different;

while(i < size){
    token = strtok(array[i], " ");
    different = strcmp(word, token);
    if(different){
        //do something
    }
    i++;
}

3

solved compare first word of a string array with a string in c