> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/v6.0.0/llms.txt

# Function subarray

Module: `noir_aztec::utils::array::subarray`

```rust
pub fn subarray<T, let SrcLen: u32, let DstLen: u32>(
    src: [T; SrcLen],
    offset: u32,
) -> [T; DstLen]
```

Returns `DstLen` elements from a source array, starting at `offset`. `DstLen` must not be larger than the number of elements past `offset`.

Examples:

```rust
let foo: [Field; 2] = subarray([1, 2, 3, 4, 5], 2);
assert_eq(foo, [3, 4]);

let bar: [Field; 5] = subarray([1, 2, 3, 4, 5], 2); // fails - we can't return 5 elements since only 3 remain
```
