operato precendance question
-
Hi developers, I am interested to so solve this chunk of code void main() { int Var = 90; if(Var += Var == ++Var == 89) printf(" %d ",Var); } After executing the code i m getting the answer "91" I am really surprised with the answer. Infact, I am not clear with operator precedence in this problem. Please give some help for it. Thanks. Amrit Agrawal, Mumbai
-
Hi developers, I am interested to so solve this chunk of code void main() { int Var = 90; if(Var += Var == ++Var == 89) printf(" %d ",Var); } After executing the code i m getting the answer "91" I am really surprised with the answer. Infact, I am not clear with operator precedence in this problem. Please give some help for it. Thanks. Amrit Agrawal, Mumbai
-
Hi developers, I am interested to so solve this chunk of code void main() { int Var = 90; if(Var += Var == ++Var == 89) printf(" %d ",Var); } After executing the code i m getting the answer "91" I am really surprised with the answer. Infact, I am not clear with operator precedence in this problem. Please give some help for it. Thanks. Amrit Agrawal, Mumbai
-
Hi developers, I am interested to so solve this chunk of code void main() { int Var = 90; if(Var += Var == ++Var == 89) printf(" %d ",Var); } After executing the code i m getting the answer "91" I am really surprised with the answer. Infact, I am not clear with operator precedence in this problem. Please give some help for it. Thanks. Amrit Agrawal, Mumbai
void main()
{
int Var = 90;
if(Var += (((Var == (++Var)) == 89)))
printf(" %d ",Var);
}Operator precedence: 1. Increment operator (++) 2. Relational operator (==), and its Associativity is Left to Right 3. Assignment operator (+=) Hope it helps...:thumbsup: