What will be the output of given code and how? Explain it. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What will be the output of given code and how? Explain it.

https://code.sololearn.com/cQ69zVQ6q22k/?ref=app

11th Dec 2019, 8:53 AM
Akash
Akash - avatar
2 Answers
+ 2
0 To know why is that you will need to know what ?: (ternary operator) is. You can check this tutorial: https://www.geeksforgeeks.org/conditional-or-ternary-operator-in-c-c/ 1 ? 0 : 2 ? 3 : 4 can be read as 1 ? 0 : (2 ? 3 : 4). For the proper meaning, it will be the statements as the following: if(1) { exp = 0; } else if(2) { exp = 3; } else { exp = 4; }
11th Dec 2019, 10:11 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
Thank you
11th Dec 2019, 10:25 AM
Akash
Akash - avatar