![]() |
I need the C equivalent of the when() function from TI-Basic. |
Previous | The C Language | Next |
Q: |
I need the C equivalent of the 'when()' function from TI-Basic.
|
A: |
This is simple:
when (condition, true_val, false_val)is translated to C as condition ? true_val : false_valFor example, sign = x >= 0 ? 1 : -1;Happy? |