? : Condition operator (ternary)
exp ? e1 : e2 Ternary conditional operator
exp any scalar expression (int, char, enum)
e1, e2 any arithmetic structure, union, or pointer
expression
The ? : operator evaluates either expression e1 or e2, depending upon
the truth of e1. If exp yields a non-zero value (TRUE), e1 is
evaluated and that is the value returned; otherwise, e2 is evaluated,
and that is the value returned.
k = (i > j) ? i : j; /* This is equivalent to: k = max(i,j) */
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster