C operator

Following table summaries the rules for precedence and associativity of all operators, including those that we have not yet discussed. Operators on the same row have the same precedence; rows are in order of decreasing precedence, so, for example, *, /, and % all have the same precedence, which is higher than that of binary + and -. The operator () refers to function call. The operators -> and . are used to access members of structures;




OPERATORSASSOCIATIVITY
Function Expression()Left to Right
Array Expression[]Left to Right
Structure Operator->Left to Right
Structure Operator.Left to Right
Unary minus-Right to Left
Increment/Decrement++, --Right to Left
One’s compliment~Right to Left
Negation!Right to Left
Address of&Right to Left
Value of address`*`Right to Left
Type cast(type)Right to Left
Size in bytessizeofRight to Left
Multiplication`*`Left to Right
Division/Left to Right
Modulus%Left to Right
Addition+Left to Right
Subtraction-Left to Right
Left shift<<Left to Right
Right shift>>Left to Right
Less than<Left to Right
Less than or equal to<=Left to Right
Greater than>Left to Right
Greater than or equal to>=Left to Right
Equal to==Left to Right
Not equal to!=Left to Right
Bitwise AND&Left to Right
Bitwise exclusive OR^Left to Right
Bitwise inclusive OR|Left to Right
Logical AND&&Left to Right
Logical OR||Left to Right
Conditional?:Right to Left
Assignment=, *=, /=, %=, +=, -=, &=, ^=, |=, <<=, >>=Right to Left
Comma,Right to Left

Unary & +, -, and * have higher precedence than the binary forms.


<-Previous artical: What Is c Language?

Next:-> If Statement and Switch case