What's the problem here? I have a block with 2500 random number and i want to sort them with bubble sort. But when I run the program I've got this:
System.IndexOutOfRangeException
error code after this:
if (szamok[i] > szamok[i + 1]).
(Sorry for bad English :/)
int r = 2500;
int seged;
while (r > 1)
{
for (int i = 0; i < 2500; i++)
{
if (szamok[i] > szamok[i + 1])
{
seged = szamok[i + 1];
szamok[i + 1] = szamok[i];
szamok[i] = seged;
}
}
r = r - 1;
}