> ## 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# Pointer Indirection

The `*` operator in C# serves three distinct syntactic roles depending on its context: as a binary arithmetic operator for multiplication, as a unary indirection operator for pointer dereferencing, and as a type modifier for declaring pointer types.

## Binary Multiplication Operator

As a binary operator, `*` computes the product of two operands. It is predefined for all built-in numeric types (integer, floating-point, and decimal).

```csharp theme={"dark"}
// Syntax
T result = operand1 * operand2;
```

When applied to integer types, if the resulting value exceeds the bounds of the return type, the behavior depends on the execution context:

* In a `checked` context, an `OverflowException` is thrown.
* In an `unchecked` context, the result is truncated by discarding high-order bits.

Floating-point multiplication (`float` and `double`) conforms to IEEE 754 arithmetic, natively handling special values such as `NaN` (Not a Number) and `Infinity`.

**Operator Overloading**
User-defined types (classes and structs) can overload the binary `*` operator to define custom multiplication mechanics.

```csharp theme={"dark"}
public static CustomType operator *(CustomType left, CustomType right)
{
    // Implementation mechanics
    return new CustomType(/* ... */);
}
```

## Unary Indirection Operator

In an `unsafe` context, the unary `*` operator performs pointer indirection (dereferencing). It evaluates to the variable located at the memory address held by the pointer operand.

```csharp theme={"dark"}
// Syntax
T value = *pointerVariable;
```

* The operand must be a pointer type.
* The operator cannot be applied to a `void*` pointer. A `void*` must be explicitly cast to a specific unmanaged pointer type before indirection.
* Applying the indirection operator to a null or invalid pointer results in undefined behavior, typically manifesting as a memory access violation.

## Pointer Type Declaration

Also restricted to `unsafe` contexts, the `*` symbol acts as a type modifier to declare a pointer to an unmanaged type.

```csharp theme={"dark"}
// Syntax
T* pointerName;
```

* `T` must be an unmanaged type (e.g., primitive numeric types, `bool`, `char`, enums, or a struct containing only unmanaged types).
* In C#, the `*` is syntactically bound to the underlying type, not the variable name. For example, the declaration `int* p1, p2;` creates two pointer variables (`p1` and `p2`), unlike C or C++ where `p2` would be a standard integer.

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