Skip to content

Commit

Permalink
Change for loop in comb_sort.c
Browse files Browse the repository at this point in the history
It can be compiled and passed in C89.
  • Loading branch information
StepfenShawn authored Aug 25, 2019
1 parent 9a75c4e commit f14320d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sorting/comb_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void sort (int *numbers, int size)

void display(int *array, int n)
{
for (int i = 0; i < n; ++i)
int i;
for (i = 0; i < n; ++i)
printf("%d ", array[i]);
printf("\n");
}
Expand All @@ -34,7 +35,8 @@ int main()
int size = 6;
int *numbers = malloc(size*sizeof(int));
printf("Insert %d unsorted numbers: \n", size);
for (int i = 0; i < size; ++i)
int i;
for (i = 0; i < size; ++i)
scanf("%d", &numbers[i]);
printf("Initial array: ");
display(numbers, size);
Expand Down

0 comments on commit f14320d

Please sign in to comment.