Thread: help for my exam. easy question

1. help for my exam. easy question

what does the question mark mean also what is the exclamation, and the colon.

Code:
```int a;
a =(6>3) ? 3 ! =5 : 9;
printf("%i",a);```

question #2

Also, i dont understand how this if... else can be the answer can someone explain this to me.
Code:
```a=(6>3) ? 3 !=5 : 9;
if(6>3)
a=3!=5;
else
a=a;```

2. The if-else means the same thing as the ?: ternary operator (I just like typing the word "ternary") -- except the last symbol should be 9.

3. { optional assignment = } conditional_expression ? true_expression : false_expression ;

If the conditional expression evaluate to true, then the "true_expression" following the question mark is evaluated. Otherwise, the "false_expression" following the colon is evaluated.

These things can nest and get ugly as well. Perhaps this is an extra credit question on your test: What will answer print as?

Code:
```
int a = 6 ;
int b = 8 ;
answer = (b > a) ? a < b ? 0 : 7 : b == a ? 1 : 5;

4. That's a clear abuse of the operator and should be avoided, just to be noted.
Todd is doing it on purpose to confuse and test! If you pass the test, then surely you shall pass your exam!