logo

Bitwise operators in C

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { int r; r = 9 & 5; printf("Result: %d\n", r); r = 9 | 5; printf("Result: %d\n", r); r = 9 ^ 5; printf("Result: %d\n", r); unsigned int p = ~5; printf("Result: %d\n", p); return 0; }
Course thumb

The C programming language made simple