Simple summary of operator precedence in C language _c language

Source: Internet
Author: User
Tags arithmetic

C language has many operators, in addition to arithmetic, there are bit operations, comparison operations, logic operations, assignment operations, and so on, dazzling at the same time, the priority also makes people headache. It is usually recommended that you do not omit parentheses when writing code, but not all programmers follow this rule, so it is necessary to record it for review.

Summarize some of the more important principles:

  • Takes the member's "0" mesh operator (). -> [] "has the highest priority;
  • The monocular operator is higher than the binocular operator;
  • Arithmetic is higher than shift operation;
  • The shift operation is higher than the comparison operation;
  • The comparison operation is higher than the bitwise operation, and the bit operation is higher than the logical operation;
  • The logical operation is higher than the assignment operation;
  • Commas are always the lowest.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.