Quick C operator precedence

hacker_compEven if you are an expert C programmer, you may need to check the operator precedence table now and then. Most of us resort to google and hit the first link. What a waste of time! In my case it distracts me from the logic I was thinking on.

Behold the quickest way to look up C operator precedence and associativity:

$ man operator
       Operator                             Associativity
       () [] -> .                           left to right
       ! ~ ++ -- + - (type) * & sizeof      right to left
       * / %                                left to right
       + -                                  left to right
       << >>                                left to right
       < <= > >=                            left to right
       == !=                                left to right
       &                                    left to right
       ^                                    left to right
       |                                    left to right
       &&                                   left to right
       ||                                   left to right
       ?:                                   right to left
       = += -= *= /= %= <<= >>= &= ^= |=    right to left
       ,                                    left to right

Cool eh?

Now that you have recovered from the initial surprise, type in:

$ man ascii

Isn’t Linux awesome? 😉

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s