0
What will be the output of given code and how? Explain it.
2 odpowiedzi
+ 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;
}
0
Thank you