1 1 vote A * B ^ C + D becomes A B C ^ * D + Here both the exponentiation and the multiplication must be done before the addition. current symbol operator stack postfix string 1 A A 2 * * A 3 B * A B 4 ^ * ^ A B 5 C * ^ A B C 6 + + A B C ^ * 7 D + A B C ^ * D 8 A B C ^ * D + in 4 line here precedence of * greater than ^ therefore * should be popped out , i checked precedence table too , someone explain this thanks Programming in C + – sumit goyal 1 843 views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply saxena0612 commented Jul 31, 2017 reply Follow flag Please check it again ! Precedence of Exponentiation operator is always greater than multiplication . For example evaluate this expression 3*2^2? 2 2 replyShare sumit goyal 1 commented Jul 31, 2017 reply Follow flag bitwise xor sign is also ^ and it has less precedence than * according to precedence table ? 0 0 replyShare Please log in or register to add a comment.
0 0 votes Maybe you interpred wrongly please check precedence order again! ^ has always greater precedence than * ! and still you have doubt then associativity rule might be considered here. Ashwin Kulkarni answered Jul 31, 2017 Ashwin Kulkarni comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes 1.Precedence of Exponentiation operator is always greater than multiplication. 2.Exponentiation is right associative 3.Multiplication is left associative apply this rules and finds an answer. Lakshman Bhaiya answered Jul 31, 2017 Lakshman Bhaiya comment Share Follow 0 reply Please log in or register to add a comment.