4.8. The Conditional Operator

The ?: operator is just like an if .. else statement except that because it is an operator you can use it within expressions.

Blah, blah, here's an example:

Example 4-6. apples.c

#include <stdio.h>

int
main()
{
  apples = 6;

  printf("I have %d apple%s\n", apples, (apples == 1) ? "" : "s");

  return 0;
}
    

?: is a ternary operator in that it takes three values, this is the only ternary operator C has.