Possible Duplicate:
Why does strcmp() return 0 when its inputs are equal?
strcmp results in false when strings are equal
I really can´t get why the function check return true!!! I use strcmp to compare the char[] pointer (hello) and the array of chars "bar".
bool check(const char* word);
char pointer[] = "hello";
int main (void)
{
bool answer = check(pointer) ;
if(answer == true)
printf("true");
else
printf("false");
return 0;
}
bool check(const char* word)
{
printf(" word = %s ", word);
if(strcmp( word , "bar"))
return true;
else
return false;
}