Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
Which should be given first preference
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
4 Antworten
+ 2
Thank u very much for the valuable info and ur time bro
+ 1
It might be quite a bit to read, but this should answer your question for C:
https://en.cppreference.com/w/c/language/operator_precedence
0
+ 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
0
Thanks