/* 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; while ((ndx > 0) && (tab[ndx] > val)) { tab[ndx + 1] = tab[ndx]; fprintf(stderr, "tab[%d] now has %d \n", ndx + 1, tab[ndx + 1]); ndx = ndx - 1; } tab[ndx] = val; counter = counter + 1; fprintf(stderr, "inserted %d in tab[%d] \n", val, ndx); howmany = fscanf(stdin, "%d", &val); } }