include<stdio.h>
include<stdlib.h>
include<string.h>
int* sort(int* L , int j,int size){
int L2= (int)malloc(size*4+4);
int ik = 0;
for(int i=0;i<size-1;i++){
if(L[i]<j){
L2[i]=L[i];
}else{
ik=i;
break;
}
}
L2[ik-1]=j;
printf("%d",ik);
for(int i=ik;i <size-1;i++)
{
L2[i]=L[i];
}
for(int i=0;i<size-1;i++){
printf("%d,",*(L2+i));
}
return L2;
}
int main(){
int pp[]={3,3,4,5,12,23,24,25,43,54,67,76,77,78,90};
sort(pp,44,15);
}
标签:int,插入,ik,L2,有序,printf,新元素,include,size From: https://www.cnblogs.com/jjjkkklll/p/18150683