If we give preference as stated in the lesson if we give preference as * / % + - Then if we execute program with a=6 b=4 c=2 then when we print result for Result=a-b+c It is showing output 4 But as per the order mentioned above we should get output of 0 so please Give me the original precedance which is perfect to be followed plz help me guys
2/19/2019 2:28:19 PM
QUICK SILVER4 Answers
New AnswerIt might be quite a bit to read, but this should answer your question for C: https://en.cppreference.com/w/c/language/operator_precedence
+ and - have the same priority (precedence) , therefore whichever operation comes first, that one is executed. If you try b+c-a you would get 0
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message