Omitted Operands in Conditional Expressions

When the GCC extensions setting is on, you may skip the second expression in a conditional expression. The default value for this expression is the first expression. The following listing shows an example.

Listing: Using the shorter form of the conditional expression

void f(int i, int j)

{

    int a = i ? i : j;

    int b = i ?: j; /* Equivalent to int b = i ? i : j; */

    /* Variables a and b are both assigned the same value. */

}