accessing my first element of array

Hello everyonel,
I have an array set like so
num=4
read name
arr[$num]=name
I go through while loop to assign different values to different array element from 1 to 4. when I try to access the FIRST element of the array I get the last one first. Like if I say ${arr[1]} it will show the last element of the array that I populated last. I do not know how to reset the pointer so when I say ${arr[1]} it will show me the very first element.

Appreciate your help.

You must have errors in your code. ${arr[1]} will retrieve whatever was stored in arr[1]. However, arr[0] would be the first element.

I am storing anything in ${arr[0]}. I'll start with 1 throughout.

Perderabo
I just changed my code and am starting from element Zero but when I go back to access them it will list last one first like so: if I have 4 elements from 0 through 3 when I try to access them it will list as 3 1 2 0 even when I say ${arr[0]}

You must have a bug in your code. Arrays work fine for me.