> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# C Bitwise AND

The `&` symbol in C represents two distinct operators depending on its lexical context and arity: the unary **address-of operator**, which yields the memory address of its operand, and the binary **bitwise AND operator**, which performs a bit-by-bit logical conjunction on two integer operands.

## Unary `&` (Address-of Operator)

When used as a prefix unary operator, `&` evaluates to the memory address of its operand, effectively generating a pointer value that points to that object within the C abstract machine.

```c theme={"dark"}
&operand
```

**Technical Mechanics:**

* **Operand Constraints:** The operand must be a valid *lvalue* (an expression that designates an object with an identifiable memory location), a function designator, or an array name.
* **Restrictions:** The unary `&` cannot be applied to expressions that are not lvalues (such as literal constants or temporary expression results), bit-fields within a `struct`, or variables explicitly declared with the `register` storage class specifier.
* **Type Evaluation:** If the operand is of type `T`, the resulting expression `&operand` evaluates to a value (which is not an lvalue) of type `T*` (pointer to `T`).

**Code Example:**

```c theme={"dark"}
#include <stdio.h>

int main(void) {
    int val = 42;
    
    /* Unary & yields the memory address of the lvalue 'val' */
    int *ptr = &val; 
    
    printf("Value: %d, Address: %p\n", val, (void*)ptr);
    return 0;
}
```

## Binary `&` (Bitwise AND Operator)

When used as an infix binary operator, `&` performs a bitwise logical AND operation. It compares the binary representations of two operands bit-by-bit, yielding a new value based on strict logical conjunction.

```c theme={"dark"}
operand1 & operand2
```

**Technical Mechanics:**

* **Operand Constraints:** Both operands must be of integral types (e.g., `char`, `short`, `int`, `long`, or their `unsigned` variants). The operator cannot be applied to floating-point types, pointers, or aggregate types.
* **Type Promotion:** Prior to the operation, the compiler applies the *usual arithmetic conversions* to both operands to establish a common type. The result of the expression evaluates to this common promoted integral type.
* **Evaluation Logic:** For each corresponding bit position in the promoted operands, the resulting bit is set to `1` if and only if both operand bits are `1`. Otherwise, the resulting bit is `0`.

```text theme={"dark"}
// Bitwise AND Truth Table
Bit A   Bit B   Result (A & B)
  0       0           0
  0       1           0
  1       0           0
  1       1           1
```

**Code Example:**

```c theme={"dark"}
#include <stdio.h>

int main(void) {
    unsigned int flags = 0x0F; /* Binary: 0000 1111 */
    unsigned int mask  = 0x05; /* Binary: 0000 0101 */
    
    /* Binary & performs bit-by-bit logical conjunction */
    unsigned int masked_result = flags & mask; 
    
    /* Result is 0x05 (Binary: 0000 0101) */
    printf("Result: 0x%02X\n", masked_result); 
    return 0;
}
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor C Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
