C/C ++ common operators and operators

Source: Internet
Author: User

C/C ++ common operators and operators
Arithmetic Operators

Syntax Explanations
A + B Addition (summation) 1 + 1... 2 + 2... 2.5 + 2. 5... and so on
A-B Subtraction (subtraction) 5-2 ..
A * B Multiplication (product) 2*5
A/B Division (molecular) 10/5
A % B Modulus (remainder) 9% 2
A ++ Then, auto-increment first participates in the operation and then auto-Increment
++ Auto-increment first before Calculation
A -- Assign a value first, subtract a for use, and then subtract
-- First subtract and then assign a value, first subtract a and then use.
A + = B It means a = a + B, that is, the result of adding the value of B to a is re-assigned to a, which is a = a + B in short form.
A-= B Abbreviated form of a = a-B
A * = B A = a * B
A/= B Abbreviated form of a = a/B
A % = B Abbreviated form of a = a % B

 

 

  

 

 

 

 

 

 

 

 

 

 

Comparison and logical operators

Syntax Explanations
A> B More than 5> 3... 100> 50
A <B Less than 5 <10... 0 <1
A> = B Greater than or equal
A <= B Less than or equal
A! = B Not equal
A = B Equal
A & B Logical AND (equivalent to AND in other languages)
A | B Logic OR (equivalent to OR in other languages) OR meaning
! A The logic is NOT (equivalent to NOT in other languages ).

 

 

 

 

 

 

 

 

 

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.