Subscribe once and get notified the moment something relevant to your career is published. No spam, no noise.
Start your programming journey with one of the most powerful and foundational languages — C. This comprehensive course is designed for absolute beginners as well as intermediate learners who want to build a solid understanding of programming using the C language. Whether you're preparing for college-level programming, cracking technical interviews, or planning to explore systems or embedded development, this course covers everything step-by-step. Through hands-on examples, real-world practice problems, and structured explanations, you’ll learn how to write clean and efficient C code — from your first printf() to advanced data structures and memory management.
Bitwise operators in C allow you to work directly with individual bits of integer data types. This is extremely useful in systems programming, embedded systems, hardware control, and performance-optimized code.
A bit is the smallest unit of data in computing. It can hold a value of either 0 or 1. All data in memory is ultimately stored and manipulated as bits.
| Operator | Symbol | Description |
|---|---|---|
| AND | & | Sets each bit to 1 if both bits are 1 |
| OR | | | Sets each bit to 1 if one of two bits is 1 |
| XOR | ^ | Sets each bit to 1 if only one of two bits is 1 |
| NOT (One’s Complement) | ~ | Inverts all the bits |
| Left Shift | << | Shifts bits to the left |
| Right Shift | >> | Shifts bits to the right |
int a = 5; // 0101 in binary
int b = 3; // 0011 in binary
printf("a & b = %d\n", a & b); // 0001 = 1
printf("a | b = %d\n", a | b); // 0111 = 7
printf("a ^ b = %d\n", a ^ b); // 0110 = 6
printf("~a = %d\n", ~a); // Bitwise NOT of a (compiler dependent)
printf("a << 1 = %d\n", a << 1); // 1010 = 10
printf("a >> 1 = %d\n", a >> 1); // 0010 = 2
Suppose you are storing user permissions (Read, Write, Execute) as bits:
#define READ 0x1 // 0001
#define WRITE 0x2 // 0010
#define EXEC 0x4 // 0100
int userPerms = READ | WRITE; // 0011
// Check if user has EXEC permission
if (userPerms & EXEC) {
printf("User can execute\n");
} else {
printf("User cannot execute\n");
}
Bit masks are patterns used to set, clear, or toggle specific bits.
// Set 2nd bit
x = x | (1 << 1);
// Clear 2nd bit
x = x & ~(1 << 1);
// Toggle 2nd bit
x = x ^ (1 << 1);
Next, we’ll explore Header Files and Modular Programming — organizing your C code for reuse and maintainability.