> For the complete documentation index, see [llms.txt](https://whs3-doge5k.gitbook.io/smartcontract-security-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whs3-doge5k.gitbook.io/smartcontract-security-docs/basics/3.-evm/evm-2/undefined-1/uint-address.md).

# uint\[], address\[]

### **특징**

<table><thead><tr><th width="261">항목</th><th>내용</th></tr></thead><tbody><tr><td><strong>타입명</strong></td><td>uint[], address[]</td></tr><tr><td><strong>크기</strong></td><td>동적 (요소 개수 × 단일 변수 크기)</td></tr><tr><td><strong>패킹 가능</strong></td><td>X (각 요소는 변수 unit단위로 개별 저장됨)</td></tr><tr><td><strong>기본 저장</strong></td><td>슬롯에는 배열 길이(length) 저장됨</td></tr></tbody></table>

***

### **예시 1 - uint\[]**

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Example4 {
    uint[] public arr;

    constructor() {
      arr.push(0x61626364);
      arr.push(0x65666768);
    }
}
```

<figure><img src="https://2462457462-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLf9vwRuaws92ULgGvzTi%2Fuploads%2FWW7i4Ha23g65sEaG8tup%2Fimage.png?alt=media&amp;token=cdd174b8-1ccb-47f3-a017-3d3c2d41b980" alt=""><figcaption></figcaption></figure>

```
// 스토리지

address: 0x0000000000000000000000000000000000000000000000000000000000000000
0x0000000000000000000000000000000000000000000000000000000000000002

address: 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563
0x0000000000000000000000000000000000000000000000000000000061626364

address: 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e564
0x0000000000000000000000000000000000000000000000000000000065666768
```

동적 배열은 슬롯 0에 배열의 길이가 하위 바이트부터 저장된다. 따라서 슬롯 0에arr 배열의 길이인 2가 저장되었다.&#x20;

배열의 값은 keccak(슬롯 주소) + index 순으로 저장되었다. arr 배열에서는 keccak(0) + 0, keccak(0) + 1 주소에 값이 하위 바이트부터 저장되었다.

***

### **예시 2 - address\[]**

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Example5 {
    address[] public arr;

    constructor() {
      arr.push(msg.sender);
      arr.push(msg.sender);
    }
}
```

<figure><img src="https://2462457462-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLf9vwRuaws92ULgGvzTi%2Fuploads%2F7SCianW5cjbj1ks9hZLR%2Fimage.png?alt=media&amp;token=183fe0ec-4b4e-472b-a9e8-fae79519de4c" alt=""><figcaption></figcaption></figure>

```
// 스토리지

address: 0x0000000000000000000000000000000000000000000000000000000000000000
0x0000000000000000000000000000000000000000000000000000000000000002

address: 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563
0x0000000000000000000000005a933567a53548b7dcb37df4af2d4b6816a476e4

address: 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e564
0x0000000000000000000000005a933567a53548b7dcb37df4af2d4b6816a476e4
```

address\[]도 동적 배열이기 때문에 uint\[]와 같은 방식으로 슬롯이 할당된다.
