syntax problem
could you please help me?
What does this mean?
|
( unHandleStatus & 0x01 ? 1 : 0 )
|
Where unHandleStatus is an unsigned int
Thanks a lot
Last edited on
It's just a compact way of writing an if-else statement.
See
Conditional ternary operator
towards the bottom of this page:
http://www.cplusplus.com/doc/tutorial/operators/
1 2
|
int x;
x = ( unHandleStatus & 0x01 ? 1 : 0 );
|
would translate as
1 2 3 4 5
|
int x;
if (unHandleStatus & 0x01)
x = 1;
else
x = 0;
|
See also
Bitwise operators
on the same page.
Topic archived. No new replies allowed.