---
title: "stride(ofValue:)"
framework: swift
role: symbol
role_heading: Type Method
path: "swift/memorylayout/stride(ofvalue:)"
---

# stride(ofValue:)

Returns the number of bytes from the start of one instance of T to the start of the next when stored in contiguous memory or in an Array<T>.

## Declaration

```swift
static func stride(ofValue value: borrowing T) -> Int
```

## Parameters

- `value`: A value representative of the type to describe.

## Return Value

Return Value The stride, in bytes, of the given value’s type.

## Discussion

Discussion This is the same as the number of bytes moved when an UnsafePointer<T> instance is incremented. T may have a lower minimal alignment that trades runtime performance for space efficiency. The result is always positive. When you have a type instead of an instance, use the MemoryLayout<T>.stride static property instead. let x: Int = 100

// Finding the stride of a value's type let s = MemoryLayout.stride(ofValue: x) // s == 8

// Finding the stride of a type directly let t = MemoryLayout<Int>.stride // t == 8

## See Also

### Accessing the Layout of a Value

- [size(ofValue:)](swift/memorylayout/size(ofvalue:).md)
- [alignment(ofValue:)](swift/memorylayout/alignment(ofvalue:).md)
