C-programming - Precedence of operators, C++ precedence of operators

Precedence of operators

C++ operators are divided into 16 categories. operatos within each category have equal precedence. The unary, conditional and assignment operators associate right to left and all other operators associate left to right.



       category                                 operator                            

1.     highest                                    ()
                                                  []
                                                  ->
                                                  ::
                                                   .


2.    unary                                      !
                                                 ~
                                                 +
                                                 _
                                                 ++
                                                 --
                                                 &
                                                 *
                                                 size of
                                                 new
                                                 delete




3.     multiplicative                           *
                                                /
                                                %



4.     member access                            .*
                                                ->*



5.      additive                               +
                                               -




6.       shift                                  <<
                                                >>



7.       relational                              <
                                                 <=
                                                 >
                                                 >=



8.       equality                                ==
                                                 !=
                               


9.                                              &



10.                                             ^


11.                                              |




12.                                             &&



13.                                             ||             



14.       conditional                           ?:



15.        assignment                           =
                                                *=
                                                /=
                                                %=
                                                +=
                                                -=
                                                &= 
                                                ^=
                                                |=
                                                <<=
                                                >>=


16.       comma                                  ,




The topic on C-programming - Precedence of operators is posted by - Malar

Hope you have enjoyed, C-programming - Precedence of operatorsThanks for your time

Tech Bluff