Please explain about precedence of operators. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please explain about precedence of operators.

I have not been able to understand this help.

19th Aug 2019, 1:08 PM
Khushi Puri
Khushi Puri - avatar
4 Answers
+ 3
If you have attended second grade in school, you might have already learnt some. This: 2 + 3 * 5 equals 17, not 25, because multiplication happens first. Multiplication has higher precedence, therefore it happens first. But here is an improvised 'table': Parentheses () Increment/decrement ++ / -- Multiplication/division * / / Addition/subtraction + / - Assignment =, +=, *=, ... Comparison operators ==, >, !=, ... Logical operators &, &&, |, ... There are of course lots more, but you can probably look it up yourself
19th Aug 2019, 1:26 PM
Airree
Airree - avatar
+ 3
Thanks but I have passed second grade. Lol
19th Aug 2019, 1:37 PM
Khushi Puri
Khushi Puri - avatar
+ 2
Precedence of operators is simply the chronology a compiler will follow while executing a program. Different operators have different preferences when it comes to programs.. some have a higher affinity as compared to others.
26th Aug 2019, 11:11 AM
kevin otieno
0
How do I learn logic of any program
29th Aug 2019, 11:17 AM
Adithya Rao
Adithya Rao - avatar