> ## 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 Member Access

The `.` (dot) operator, formally known as the direct member access operator, is a binary operator used to access the individual members of a `struct` or `union` object. It evaluates to the value of the specified member and yields the type of that specific member.

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

## Operand Constraints and Semantics

* **Left Operand (`operand1`)**: Must be an expression that evaluates to a complete `struct` or `union` type. It cannot be a pointer to a struct or union; pointer types require the indirect member access operator (`->`).
* **Right Operand (`operand2`)**: Must be a valid identifier that explicitly names a member declared within the struct or union type of the left operand.
* **Atomic Semantics (C11)**: The constraints of the C standard explicitly allow the left operand to have an `_Atomic`-qualified `struct` or `union` type. However, the semantic rules dictate that evaluating the `.` operator on an atomic struct or union object results in undefined behavior.

## Value Categories and Qualifiers

The value category of the expression resulting from the `.` operator depends entirely on the left operand:

* **Lvalue/Rvalue**: If the left operand is an *lvalue* (e.g., an instantiated variable), the result is an *lvalue*. If the left operand is an *rvalue* (e.g., a struct returned by value from a function), the result is an *rvalue*.
* **Modifiable Lvalue**: An lvalue result is a *modifiable lvalue* (capable of being assigned to) only if all the following conditions are met:
  * The member is not an array type.
  * The left operand is not `const`-qualified.
  * The specific member was not declared with the `const` qualifier.
  * **Recursive `const` Rule**: If the accessed member is itself a `struct` or `union`, it must not contain any `const`-qualified members, evaluated recursively through all nested aggregates or unions. (This rule has existed since C90).
* **Type Qualifiers**: The resulting expression inherits the type qualifiers of the left operand. If the struct or union object is `const`-qualified or `volatile`-qualified, the accessed member is treated as `const` or `volatile` respectively, in addition to any qualifiers explicitly applied to the member's original declaration.
* **Bit-fields**: If the right operand designates a bit-field member, the `.` operator yields an lvalue (provided the left operand is an lvalue), but C semantics dictate that the address-of operator (`&`) cannot be applied to this resulting bit-field.

## Precedence and Associativity

* **Precedence**: The `.` operator possesses the highest precedence in C (Level 1, Postfix operators). It shares this exact precedence tier with the indirect member access (`->`), function call (`()`), array subscript (`[]`), postfix increment (`++`), and postfix decrement (`--`) operators.
* **Associativity**: It evaluates strictly from left to right. This allows for direct chaining when dealing with nested structures.

```c theme={"dark"}
// Syntax visualization of left-to-right associativity
structA.structB.memberC

// Evaluates as:
(structA.structB).memberC
```

## Underlying Mechanics

At compile time, the C compiler resolves the `.` operator by calculating a fixed byte offset for the member, accounting for architecture-specific alignment padding.

* **Address Calculation**: During execution, the compiler determines the member's location by adding this constant offset to the base address or location of the struct or union.
* **Non-Addressable Objects**: If the left operand is an rvalue or declared with the `register` storage class, the C standard prohibits taking its address using the `&` operator. The object may physically reside in memory (such as on the stack) or in hardware registers; regardless of physical placement, the compiler logically extracts the member's value based on its structural offset.
* **Runtime Overhead**: While the member's offset is resolved entirely at compile time, accessing a member at a non-zero offset may still require CPU instructions for address calculation at runtime. If the offset is too large to fold into a single instruction's addressing mode, the CPU must execute additional instructions to compute the final effective address.

<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>
