Correction:
(statment) ? a : b
if the statement is true it takes a
if the statement is false it takes b
however because you cant use block statements like the if function it is only useful to save coding space if the only action taken is to give the variable a value. for example
if(x == 0)
{
MessageBox(NULL, "X = 0", "Message", MB_ICONINFORMATION | MB_OK);
SomeOtherFunction();
...
}
else
{
....
}
cannot be simplified but...
the abs function (always +) which is:
if(a > 0)
return a;
else
return -a;
can be defined as
#define abs(a) (a > 0) ? a : -a;