Mega Code Archive

 
Categories / C / Code Snippets
 

Bitwise calculation

#include <stdio.h> int main(void) { int j; j = 120; printf("initial value of j: %d\n", j); j = j ^ 220; printf("j after first XOR: %d\n", j); j = j ^ 220; printf("j after second XOR: %d\n", j); return 0; }