index now starts from 1

This commit is contained in:
tania-cmyk 2020-02-02 13:45:59 +05:30
parent 90e6ee0771
commit aac957c7a2

View File

@ -6,7 +6,9 @@ void sort(int *numbers, int size)
int pos = 0;
while (pos < size)
{
if (numbers[pos] >= numbers[pos-1])
if (pos == 0)
pos = 1;
if (numbers[pos] >= numbers[pos-1] && pos==0)
pos++;
else
{
@ -15,8 +17,7 @@ void sort(int *numbers, int size)
numbers[pos] = tmp;
pos--;
if (pos == 0)
pos = 1;
}
}
}
@ -45,4 +46,3 @@ int main()
free(numbers);
return 0;
}