# Declare and fill array of type UInt16

**URL:** <https://forum.crystal-lang.org/t/declare-and-fill-array-of-type-uint16/5702>\
**Category:** Help & Support\
**Created:** [May 24, 2023, 3:56pm UTC](https://forum.crystal-lang.org/t/declare-and-fill-array-of-type-uint16/5702 "2023-05-24T15:56:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gummybears](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/gummybears/32/1886_2.png) [@gummybears](https://forum.crystal-lang.org/u/gummybears)\
**Post date:** [May 24, 2023, 3:56pm UTC](https://forum.crystal-lang.org/t/declare-and-fill-array-of-type-uint16/5702/1 "2023-05-24T15:56:53Z")

</div>

Hi,

The array has to contain UInt16 values so my first attempt is

```auto
header = [
0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x03, 0x00, 0xFE, 0xFF, 0x09, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
[truncated]
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
]

```

This gives me an array of Int32 instead of UInt16.  
Any thoughts?  
Thanks

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)\
**Post date:** [May 24, 2023, 3:58pm UTC](https://forum.crystal-lang.org/t/declare-and-fill-array-of-type-uint16/5702/2 "2023-05-24T15:58:23Z")

</div>

The easiest way would be to do like `[0xD0, ...] of UInt16` or `UInt16[0xD0, ...]`.

---

<div class="post-metadata">

**Author:** ![gummybears](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/gummybears/32/1886_2.png) [@gummybears](https://forum.crystal-lang.org/u/gummybears)\
**Post date:** [May 24, 2023, 4:04pm UTC](https://forum.crystal-lang.org/t/declare-and-fill-array-of-type-uint16/5702/3 "2023-05-24T16:04:47Z")

</div>

It works. Thanks
