| control/raw-anti-logical-exp.c - Misforståede logiske udtryk. | Lektion 3 - slide 6 : 25 Program 2 |
#include <stdio.h>
int main(void) {
int a = 7, b = 8, c = 6;
/* Both a and b are greater than c */
a && b > c; /* WRONG */
a > c && b > c; /* Correct */
/* Both a, b, and c are non-zero */
a, b, c != 0 /* WRONG */
a != 0 && b != 0 && c != 0 /* Correct */
/* The value of a is in between c and b */
c <= a <= b; /* WRONG */
c <= a && a <= b; /* Correct */
return 0;
}