I'm currently attempting to make a Bubble Sort system in C# and to do this I need to be able to take a value out of an array based on its position. However, when I put int a = (array[0]) which should give me the 1st value in the array, I instead get a different value, often the 3rd? Please help me find my code copied below!
using System;
public class Bubble_Sort
{
public static void Main(string[] args)
{
int[] numbers = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int i = (numbers[0]);
Console.WriteLine(numbers[i]);
int a = (numbers[7]);
Console.WriteLine(numbers[a]);
Console.Read();
}
}
Any help is appreciated, this is really doing my head in!
Alec Knapper.