# What's the right way to have an array inside the interactive shell?

**URL:** <https://root-forum.cern.ch/t/whats-the-right-way-to-have-an-array-inside-the-interactive-shell/52581>\
**Category:** Newbie\
**Created:** [December 1, 2022, 6:15pm UTC](https://root-forum.cern.ch/t/whats-the-right-way-to-have-an-array-inside-the-interactive-shell/52581 "2022-12-01T18:15:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shu11](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@shu11](https://root-forum.cern.ch/u/shu11)\
**Post date:** [December 1, 2022, 6:15pm UTC](https://root-forum.cern.ch/t/whats-the-right-way-to-have-an-array-inside-the-interactive-shell/52581/1 "2022-12-01T18:15:03Z")

</div>

Hi,

Current ROOT version is 6.26/08. Just define an array like the following (doesn’t matter what types the array is, symptom is the same).

root [6] uint8\_t bin[]={1,0,0,1,0,0,0,0,1,1,0};  
root [7] bin[0]  
(unsigned char) ‘0x01’  
root [8] bin[1]  
(unsigned char) ‘0x01’

Looks like the array can’t be indexed inside the shell?

Thanks

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [December 1, 2022, 8:43pm UTC](https://root-forum.cern.ch/t/whats-the-right-way-to-have-an-array-inside-the-interactive-shell/52581/2 "2022-12-01T20:43:54Z")

</div>

Maybe:

> [@I wonder why initailizing an array got an unexpected result](https://root-forum.cern.ch/t/i-wonder-why-initailizing-an-array-got-an-unexpected-result/52499/8):
>
> That’s a known issue. See [[cling,win32] Read-after-write of variable of type `double` does not yield the correct result · Issue #9809 · root-project/root · GitHub](https://github.com/root-project/root/issues/9809)

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [December 1, 2022, 8:46pm UTC](https://root-forum.cern.ch/t/whats-the-right-way-to-have-an-array-inside-the-interactive-shell/52581/3 "2022-12-01T20:46:43Z")

</div>

It looks to be platforms dependent (i.e. your example works fine for me). So if you are using 32bit build, Wile might have the right pointer.

---

<div class="post-metadata">

**Author:** ![shu11](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@shu11](https://root-forum.cern.ch/u/shu11)\
**Post date:** [December 1, 2022, 10:45pm UTC](https://root-forum.cern.ch/t/whats-the-right-way-to-have-an-array-inside-the-interactive-shell/52581/4 "2022-12-01T22:45:59Z")

</div>

Thanks for the links. Now understand why. I built ROOT from Visual Studio. From the links, it seemed VS had used win32 instead of win64 (this is a 64-bit machine). In addition to use 6.27.01.win64, is there a switch to force VS to use win64?

---

<div class="post-metadata">

**Author:** ![shu11](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/5daacb/32.png) [@shu11](https://root-forum.cern.ch/u/shu11)\
**Post date:** [December 1, 2022, 10:47pm UTC](https://root-forum.cern.ch/t/whats-the-right-way-to-have-an-array-inside-the-interactive-shell/52581/5 "2022-12-01T22:47:19Z")

</div>

Correct. Linux 64-bit doesn’t have this issue. Only happen in Windows
