A
abir
I never fill comfortable with ?: and , operator.
There is problem with this statement
int x = 6, y = 20;
int p = 6;
p == 5 ? x = 8, y = 60 : p == 6 ? x = 9, y = 61 : x = 10, y = 62;
i get here x = 9, y = 62 (unexpected)
if i write
p == 5 ? (x = 8, y = 60) : (p == 6 ? (x = 9, y = 61) : (x = 10, y =
62) );
i get x = 9, y = 61 (expected)
i even doubt if the second one is correct, though it gives correct
answer.
what is the problem here?
compiler MSVC 9 Express
thanks
abir
There is problem with this statement
int x = 6, y = 20;
int p = 6;
p == 5 ? x = 8, y = 60 : p == 6 ? x = 9, y = 61 : x = 10, y = 62;
i get here x = 9, y = 62 (unexpected)
if i write
p == 5 ? (x = 8, y = 60) : (p == 6 ? (x = 9, y = 61) : (x = 10, y =
62) );
i get x = 9, y = 61 (expected)
i even doubt if the second one is correct, though it gives correct
answer.
what is the problem here?
compiler MSVC 9 Express
thanks
abir