I keep getting this error but am at a loss as to how to solve it! It's driving me crazy and getting frustrated with it.

incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *'

I get this error for this line:

if(strcmp(temp, thisNode->word == 0)

I know the reason, and it's because strcmp expects the same data type. But my temp is only a char as shown below:

    //lower case the word
    int wordLength  = strlen(word);
    char temp[wordLength + 1];    
    for(int i = 0; i < wordLength; i++)
            temp[i] = tolower(word[i]);
            temp[i] = word[i];
    temp[wordLength] = '\0';

So how can i convert temp to be the right data type so i can use strcmp?

If i can't, how else do i compare them can i simply loop each character?

1 Answer 1


You have just placed the parenthesis in the wrong place. It shouldn't be

if(strcmp(temp, thisNode->word == 0)) 


if(strcmp(temp, thisNode->word) == 0)

The condition

thisNode->word == 0

will always return false which is equal to 0. So you are comparing temp which is a string with 0 which is an int.

If this answers your question please accept it by clicking the gray check-mark to the left, so that it becomes green. You can also vote it up by pressing the up arrow above the check-mark.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .