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 :: array value from user c 
C :: Counting Sort C 
C :: go Iterating over an array using a range operator 
C :: text berjalan html 
C :: append to list in c 
C :: c float 
C :: comment in c language 
C :: sleep function in c 
C :: c recursion func revers number 
C :: fgets remove newline 
C :: prime factorization of factorials using c 
C :: how i send custom data in model field rest_framework serializer 
C :: how to add 1 to 10 in c 
C :: how to use malloc in c 
C :: print command for rust unit-test 
C :: check whether a number is prime or not in c 
C :: set the nth bit 
C :: c double 
C :: ecrire programme en C une fonction remplir tableau et un fonction inverser 
C :: delay in c programming for linux 
C :: how to print % in c 
C :: Relational Operator in C language 
C :: what is the use of malloc in c 
C :: pointer in c 
C :: convert python to c 
C :: setw in c 
C :: c hello word 
C :: onvert a string into 2d string in c 
C :: how to make C program blink on screen 
C :: input multipal data types 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =