<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UnsafeMutablePointer/subscript(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Subscript",
  "symbol" : {
    "kind" : "Instance Subscript",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SpsRi_zrlEyxSicip"
  },
  "title" : "subscript(_:)"
}
-->

# subscript(_:)

Reads or updates the pointee at the specified offset from this pointer.

```
subscript(i: Int) -> Pointee { get nonmutating set }
```

## Parameters

`i`

The offset from this pointer at which to access an
instance, measured in strides of the pointer’s `Pointee` type.

## Overview

For a pointer `p`, the memory at `p + i` must be initialized when reading
the value by using the subscript. When the subscript is used as the left
side of an assignment, the memory at `p + i` is updated. The memory must
be initialized or the pointer’s `Pointee` type must be a trivial type.

Uninitialized memory cannot be initialized to a nontrivial type
using this subscript. Instead, use an initializing method, such as
`initialize(to:)`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)