The following lines refer to position pos + 1 which would go beyond the end of the array if 13 is used.
if (StartingArray[pos] > StartingArray[pos+1]) // flip to > if you want smallest to largest
{
tempd = StartingArray[pos];
StartingArray[pos] = StartingArray[pos+1];
StartingArray[pos+1] = tempd;
temps = StartingName[pos];
StartingName[pos] = StartingName[pos+1];
StartingName[pos+1] = temps;
swapped = true;
}
Robert