Unexpected Result, Ternary Operator in Gnu C
问题 So the operator precedence of the ternary operator in C seems truly bizarre to me. Case in point: #include <stdio.h> int main () { int i=5; int j=6; int k=7; printf("A: %d\n", i+j+(k!=7)?1:11); //prints 1 printf("B: %d\n", i+j+((k!=7)?1:11)); //prints 22 return 0; } This seems similar to the question here: C++ ternary conditional and assignment operator precedence Ternary operator evaluation order As a clarification, I understand that the parentheses make it work, as my comments in my