This is also known as the ternary operator. This operator has three expressions—testExpression, ifTrueExpression, and ifFalseExpression. It looks like this:
testExpression ? ifTrueExpression : ifFalseExpression
In this expression, testExpression is evaluated. If the testExpression result is true, or nonzero, then ifTrueExpression is evaluated and its result becomes the expression result. If the testExpression result is false, or exactly zero, then ifFalseExpression is evaluated and its result becomes the expression result. Either ifTrueExpression is evaluated or ifFalseExpression is evaluated—never both.
This operator is useful in odd places, such as setting switches, building string values, and printing out various messages. In the following example, we'll use it to add pluralization to a word if it makes sense in the text string:
printf( "Length = %d meter%c\n" , len, len...