# Include <stdio. h>
Void print_result (float *, INT );
Void insert_sort (float *, INT );
Int main ()
{
Int I;
Float array [10];
Float * pointer;
Printf ("Enter 10: \ n ");
For (I = 0; I <10; I ++)
{
Scanf ("% F", & array [I]);
}
Pointer = array;
Insert_sort (pointer, 10 );
Print_result (pointer, 10 );
Return 0;
}
Void print_result (float * P, int N)
{// Output result
Int K;
For (k = 0; k <n; k ++)
{
Printf ("% G \ t", * (p + k ));
}
}
Void insert_sort (float * PT, int N)
{// Direct insertion sorting method with all pointers
Int I, J;
Float tempnum;
For (I = 1; I <n; I ++ ){
For (j = 0; j <I; j ++)
{
If (* (Pt + J) <* (Pt + I ))
{
Tempnum = * (Pt + I );
* (Pt + I) = * (Pt + J );
* (Pt + J) = tempnum;
}
}
}
}
Configure a previous image and code
/// ======================================
Void insertsort (INT arr [], int N)
{
Printf ("\ n direct insertion sorting process: \ n ");
Int I, j, T;
For (I = 1; I <n; I ++)
{
For (j = 0; j <I; j ++)
{
If (ARR [J]> arr [I])
{
T = arr [I];
Arr [I] = arr [J];
Arr [J] = T;
}
}
Int L = 0;
For (; L <n; l ++ ){
Printf ("% 3C", arr [l]);
}
Printf ("\ n ");
}