search
Log In
0 votes
691 views

Hi,

Is there any smart way to learn operator precedence table ? (means can we form some kind of logical connection instead of mugging entire table.) If some good reference could be provided then it will be great help.

PS: http://www.geeksforgeeks.org/c-operator-precedence-associativity/

in Programming 691 views
1
I am guessing this same concept is used in Compiler Design parsing also!
So you can watch RVR or Nptel

2 Answers

1 vote

Hi Guys,

Please refer -> https://stackoverflow.com/questions/4204973/shortcut-to-remember-the-order-of-evaluation-and-precedence-of-operators-in-c

PUMA IS REBL ( spell "REBL" as if "REBEL"). or PUMA'S REBL TAC (with a puma being a cat and since our cat is a spelling rebel, it writes "cat" backwards)

For Associative All except Unary,Assignment and Ternary are Left to Right.

0 votes

This video will definitely help you

Related questions

0 votes
0 answers
1
200 views
#include <stdio.h> int main(){ int val=10; int c= val+ ~val + ++val; printf("%d %d",c,val); } Output is 10 11 #include <stdio.h> int main(){ int val=10; int c= val + (~val + ++val); printf("%d %d",c,val); } output is 11 11 #include <stdio.h> int main(){ int val=10; int c=(val) + (~val + ++val); printf("%d %d",c,val); } output is 11 11 What is the difference?
asked May 20, 2018 in Programming SreenivasaRaju 200 views
0 votes
1 answer
2
0 votes
1 answer
3
1.1k views
int main(){ int a = 4,b = 5,c = 6; int k = ++a || ++b && c++; printf("%d %d %d %d",a,b,c,k); return 0; } o/p 5 5 6 1 Above code will not increment b and c why??even the precedence of logical And is more than logical Or
asked Feb 3, 2016 in Programming indrajeet 1.1k views
1 vote
3 answers
4
675 views
State True/False: "If two operators in an expression have equal precedence but different associativity then order of their evaluation is compiler dependent." Considering my adaptation to this question: if * and ^(exponentiation) has same precedence if * associate from right to left and ^ associates from left to right, then what will be the result of 2*2^3*4 ?
asked Jan 31, 2017 in Programming gate_forum 675 views
...