Conditional structures/C: Difference between revisions

m
→‎Ternary ?:: removed {{works with}}
m (→‎switch: removed {{works with}})
m (→‎Ternary ?:: removed {{works with}})
 
Line 90:
 
===Ternary ?:===
{{works with|gcc|4.0.2}}
 
Conditionals in C can also be done with the ternary operator, ?:. The arguments are expressions, and a?b:c is an expression as well. However, since many things in C are expressions (this especially includes assignments and function calls), ?: can be used for those, too. However, the if/else construct is usually more readable and therefore preferred.
Anonymous user