A detailed description of the C-bit operator

Source: Internet
Author: User
Tags bitwise

Original link: https://www.cnblogs.com/911/archive/2008/05/20/1203477.html

A bitwise operation is a binary-based operation. In system software, it is often necessary to deal with bits problems. The C language provides 6 bit operations.

Operator. These operators can only be used for integer operands, that is, only for signed or unsigned char,short,int and long types

List of bit operators:

&: Bitwise AND if two corresponding bits are 1, then the result value of this bit is 1, otherwise 0

| : A bitwise or two corresponding bits as long as there is a value of 1, the result of the bit is 1

^: Bitwise XOR or if the two bits values of the participating operations are the same then 0, otherwise 1

<<: Left shifts all bits of a number to the left n bits, right 0

>>: Shift right shifts the bits of a number to the right by n bits, to the right end of the low is discarded, for unsigned number, high 0

A detailed description of the C-bit operator

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.