07-25-2023, 01:27 PM
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
// 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
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos