Here's an example.
#include
void main()
{
int i,a[10],temp,pos;
printf("为数组元素赋值:\n");
for(i=0;i<10;i++)
{
printf("a[%d]=",i);
scanf("%d",&a[i]);
}
for(i=1;i<10;i++)
{
temp=a[i];
pos=i-1;
while((pos>=0) && (temppos]))
{
a[pos+1]=a[pos];
pos--;
}
a[pos+1]=temp;
}
for(i=0;i<10;i++)
{
printf("%d\t",a[i]);
}
}