AnsweredAssumed Answered

Cosmic compiler and strcmp

Question asked by de_craemer.klaas on Mar 23, 2013
Latest reply on Mar 26, 2013 by de_craemer.klaas
I'm trying to compare an input string, and using the COSMIC C environment. I've had no luck with their supplied strcmp function, so I gave up and wrote my own...
But still wondering what is wrong...

Here is the test case, when I run it, the result of strcmp is always zero:
Anyone has an idea?

u8 result;
result = strcmp("A\0", "A\0");
if (result != 0){
    SerialPutString("A=A Not zero\n");
} else {
    SerialPutString("A=A Zero\n");
}
 
result = strcmp("A\0", "B\0");
if (result != 0){
    SerialPutString("A=B Not zero\n");
} else {
    SerialPutString("A=B Zero\n");
}
 
while(1){
}

Outcomes