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