Associativity of ternary operator is right to left, and precedence of ternary operator is only greater than assignment operators which doesn’t exist in the while condition.
Thus first j ? i*3 : --j is executed, leading to the value of 3.
Now the first ternary operator is executed. Since precedence of addition/ multiplication are higher than ?: hence
i + 1*i + 2 is executed which gives value of 4 which is true value. thus the ternary operator replaces the condition statement with --i which decrements the value of i to 0 and returns 0. thus while loop exits.
Hence printf prints 0
Hope this helps