# Mathematical array problem

**URL:** <https://forum.kirupa.com/t/mathematical-array-problem/243242>\
**Category:** Uncategorized\
**Created:** [November 4, 2007, 11:21pm UTC](https://forum.kirupa.com/t/mathematical-array-problem/243242 "2007-11-04T23:21:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [November 4, 2007, 11:21pm UTC](https://forum.kirupa.com/t/mathematical-array-problem/243242/1 "2007-11-04T23:21:37Z")

</div>

hi there,

im having difficulties calculating the distance between array indexes. for example:

```auto
chararray = new Array(" ", "_", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");

```

this is my array… and now i want to calculate the distance between ‘X’ and ’ @’. This should be 6. How should this be calculated?
