/* p19.c */ #include int tab[100]; int main() { int ndx; int counter; int howmany; int val; counter = 0; howmany = fscanf(stdin, "%d", &val); while (howmany > 0) { ndx = counter - 1; while ((ndx > 0) && (tab[ndx] > val)) { tab[ndx + 1] = tab[ndx]; fprintf(stderr, "tab[%d] now has %d \n", ndx + 1, tab[ndx + 1]); } tab[ndx - 1] = val; fprintf(stderr, "inserted %d in tab[%d] \n", val, ndx - 1); } }