mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
Change for loop in comb_sort.c
It can be compiled and passed in C89.
This commit is contained in:
parent
9a75c4e850
commit
f14320d137
@ -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");
|
||||
}
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user