DEV Community

Alpha_Edit
Alpha_Edit

Posted on

5 4 1 1 1

C Programming Cheat Sheet - 2

#c

Here is the C Programming Cheat Sheet - Part 2

2.Expression & Operators Precedence

Following table summarizes the rules for precedence and associativity of all operators, including those that we have not yet discussed. Operators on the same line 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;

Description Operators Associativity
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 >+ 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
Logical AND && Left to Right
Conditional ?: Left to Right
Assignment =, *=, /=, %=, +=, -=, &=, ^=, =, <<=, >>= Left to Right
Comma , Right to Left

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay