QP School
Bit manipulation - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: Bit manipulation (/showthread.php?tid=5104)



Bit manipulation - Qomplainerz - 07-25-2023

Bit manipulation involves performing operations at the bit level.

// Setting a bit using bitwise OR (|)
int num = 5; // Binary: 0101
int mask = 1; // Binary: 0001
int result = num | mask; // Binary: 0101 | 0001 = 0101
printf("%d\n", result); // Output: 5