Users Online

· Guests Online: 145

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

#C PROGRAMMING LANGUAGE TUTORIALS

 

Expression & Operators Precedence - C Programming

 

 

 

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;

DESCRIPTIONOPERATORSASSOCIATIVITY
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 bytes sizeof Right 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.

 

 

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 1.04 seconds
10,809,462 unique visits