Share
Explore BrainMass

Declarations in C Programming

****This is "C" Programming****

I selected "b" but I've always seem to get lost doing Boolean.

Assuming the following declarations:

int A=1, B=2, C=3, D=4;

What is the value of the following (Boolean) expression?

C == D || B > A && C

a. 0
b. 1
c. There is a syntax error in the expression.
d. There is no error, but the value cannot be determined from the information given.

My breakdown is as follows:

C == D || B > A && C
3 == 4 || 2 > 1 && 3
(3 == 4) || (2 > (1 && 3))
0 || (2 > (1))
0 || 1
answer is true or 1

Solution Preview

If you look into C operator precedence [1] you will find that

the greater than operator >
has a higher precedence, next comes relational equality ==, next ...

$2.19