Consider the following code:
int main(void)
{
int x=10;
if(x > 30,400)
printf("yes\n");
else
printf("no\n");
x=100;
if(x > 30,400)
printf("yes\n");
else
printf("no\n");
return 0;
}
if you run it it will print:
yes yes
The problem here is the extra comma in the if statement:
if(x > 30,400)
It is not a compilation error, instead the compiler parses it as 2 statements: x>30 and 400
The if statement is checking only the last statement and because 400 is true , it will always be true (no matter what x value is)
Conclusion:
Always check compiler warnings , make it display all warnings (-Wall) and use static analysis tools