</pre><pre name="code" class="cpp">
#include <stdio.h>
void Insert(int a[],int length)
{
int i,j,key;
for( i=1;i<length;i++)
{
j=i-1;
key = a[i];
while(j>=0&&a[j]>key)
{
a[j+1]=a[j];
j--;
}
a[j+1]=key;
}
}
void print_array(int a[],int length)
{
for(int i=0;i<length;i++)
{
printf("%d ",a[i]);
}
printf("\n");
}
int main(void)
{
int a[]={5,4,3,2,0};
Insert(a,5);
print_array(a,5);
return 0;
}