#include<stdio.h>
#define MAX 100
int insert_sort(int *array, int length);
/* int check_digit(int num); */
int main()
{
int i,length;
int array[MAX];
printf("please input the length of the array:");
scanf("%d",&length);
/* while(1)
{
if(check_digit(length) && length < MAX)
break;
else
printf("please input the length of the array:")
scanf("%d",&length);
}
*/
for(i = 0; i < length; i++)
{
printf("please input the element of the array:");
scanf("%d",&array[i]);
}
-
insert_sort(array,length);
for(i = 0; i < length; i++)
}
int insert_sort(int *array, int length)
{
int i,j,key;
for(j = 1; j < length; j++)
{
key = array[j];
i = j - 1;
while(i >= 0 && array[i] > key)
{
array[i+1] = array[i];
i = i - 1;
}
array[i+1] = key;
}
}