Search
 
SCRIPT & CODE EXAMPLE
 

C

bitwise operators in c

~  ==> bitwise NOT
&  ==> bitwise AND
|  ==> bitwise OR
^  ==> bitwise XOR
>> ==> bit shift right
<< ==> bit shift left
Comment

bitwise AND in c

#include <stdio.h>
int main()
{
    int a = 12, b = 25;
    printf("Output = %d", a&b);
    return 0;
}
Comment

Bitwise Operators in C language

int main()

{

    // a = 5(00000101), b = 9(00001001)
    unsigned char a = 5, b = 9;

    // The result is 00000001

    printf("a = %d, b = %d
", a, b);
    printf("a&b = %d
", a & b);

    // The result is 00001101
    printf("a|b = %d
", a | b);

    // The result is 00001100
    printf("a^b = %d
", a ^ b);

    // The result is 11111010
    printf("~a = %d
", a = ~a);

    // The result is 00010010
    printf("b<<1 = %d
", b << 1);

    // The result is 00000100
    printf("b>>1 = %d
", b >> 1);

    return 0;

}
Comment

PREVIOUS NEXT
Code Example
C :: highest common factor algorithm in c 
C :: gcd and lcd in c 
C :: c remove last charachter from string 
C :: delay in c programming for windows 
C :: bubble sort c 
C :: set the nth bit 
C :: c change value of const 
C :: create node in c 
C :: convert char number to int in c 
C :: imprimir matriz 
C :: how to change file permissions in C language 
C :: build a linked list in c 
C :: wifi access point in esp8266 
C :: esp32 dhcp server 
C :: time include c 
C :: c conventions 
C :: C float and double Output 
C :: c arrays and pointers 
C :: create syscall 
C :: allintext:christie kiser filetype:log 
C :: c get int inpot 
C :: retoure a la ligne C 
C :: divide a linked list into three parts based on their position mod 3. 
C :: how to make C program blink on screen 
C :: What keyword covers unhandled possibilities? 
C :: pebble scripting Boolean expression 
C :: when to add & in snacf c 
C :: add last in list c 
C :: wpdb add temporary while drop table 
C :: opération bit à bit c 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =