bool bSwitch = true;
double dSum = 1 + bSwitch?1:2;
So “dSum” is:
a)=1
b)=2
c)=3
The result is just rediculous and i got bashed for it…
I’m using VS2008 -> “Microsoft (R) 32-Bit C/C++-Optimierungscompiler Version 15.00.21022.08 für 80×86”
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
operator+has higher precedence, than the ternary operator?:.So, this is equivalent to
Thus, you have
dSum == 1.