#include int sort_get_index(float tab[], int top, float val) { int i; for(i=0; i= val) return i; } return top; } void sort_insert_at(float tab[], int i, int top, float val) { int j; for(j=top; j>i; j--) { tab[j] = tab[j-1]; } tab[i] = val; } int main(int argc, char **argv) { float tab[] = { 1, 3, 5, 7, 0 }; int i; printf("Insert 0 at %d, 4 at %d, 10 at %d\n", sort_get_index(tab, 4, 0), sort_get_index(tab, 4, 4), sort_get_index(tab, 4, 10)); sort_insert_at(tab, 2, 4, 3.5); for(i=0; i<5; i++) printf("%f ", tab[i]); printf("\n"); return 0; }