---
title: "3.14 Bitwise AND Operator (&)"
description: "The bitwise AND operator (`&`) performs a logical AND operation on each corresponding bit of two integral operands. A bit in the result is set to `1` only if the corresponding bits in both operands are `1`; otherwise, the result…"
url: "https://edcret.in/docs/cpp-programming/operators-cplusplus/3-14-bitwise-and-operator/"
updated: "2026-07-28"
category: C++ Programming / Operators
---

# 3.14 Bitwise AND Operator (&)

The bitwise AND operator (`&`) performs a logical AND operation on each corresponding bit of two integral operands. A bit in the result is set to `1` only if the corresponding bits in both operands are `1`; otherwise, the result bit is `0`.

Bitwise operators are commonly used in systems programming, embedded programming, device drivers, and applications that manipulate individual bits.

## Source Code

```
#include <iostream>

int main()
{
    int num1 = 12;
    int num2 = 10;

    int result = num1 & num2;

    std::cout << "First Number : " << num1 << '\n';
    std::cout << "Second Number: " << num2 << '\n';
    std::cout << "Result       : " << result << '\n';

    return 0;
}
```

## Output

```
First Number : 12
Second Number: 10
Result       : 8
```

## Explanation

- The bitwise AND operator (`&`) compares the corresponding bits of two integral operands.
- A result bit is set to `1` only when both corresponding operand bits are `1`.
- If either corresponding bit is `0`, the resulting bit is `0`.
- The operands `12` and `10` have the following binary representations:`12 = 1100₂ 10 = 1010₂ -------------- & = 1000₂`
- The binary result `1000₂` is equal to the decimal value `8`.
- Bitwise AND operations are commonly used for bit masking and testing specific bits.
- The bitwise AND operator is applicable only to integral data types.
- `return 0;` terminates the program successfully.
