[CSI] presedence of the conditional operator

Mikhail Nesterenko mikhail at cs.kent.edu
Wed Jun 29 12:58:48 EDT 2016


CSI students,

it turns out the presedence of the conditional oerator is pretty
low. It is just above the assignment operator and below logical
operators and arithmetic operators. Thus, the value of this expression

	5 < 3 ? 8 : 1+10

is 11. 

Here is a complete operator precedence list for C++

   http://en.cppreference.com/w/cpp/language/operator_precedence

Thanks,
-- 
Mikhail


More information about the cs13001 mailing list