/* Logical2.c */
#include <stdio.h>

main()
{
 int white, black, friendly, acceptable;

 white = 1;     /* dog is white */
 black = 0;     /* dog is not black */
 friendly = 0;  /* dog is not friendly */

 /* The following statement produces incorrect results due to the
 /* order of operations. */
 acceptable = (white || black && friendly);
 printf("acceptable = %d\n", acceptable);

 /* The parens in the following statement override the
 /* order of operations and the statement produces 
 /* the correct result. */
 acceptable = ((white || black) && friendly);
 printf("acceptable = %d\n", acceptable);

 return 0;
}
