Don't print more elements than there are in src/sorting/main.c:printlist.
authorW. Trevor King <wking@drexel.edu>
Tue, 26 Oct 2010 14:15:21 +0000 (10:15 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 26 Oct 2010 14:15:21 +0000 (10:15 -0400)
src/sorting/main.c

index d8c3e35fb32536bb959622b8463296e199ba2c2b..624638435e55ab5b5e5d2fb94769025c821167c6 100644 (file)
@@ -17,6 +17,8 @@ void printlist(FILE * stream, int list_size, double *list, int num_shown)
 {
        int i;
        if (num_shown > 0) {
+               if (num_shown > list_size/2)
+                       num_shown = list_size/2;
                for (i = 0; i < num_shown; i++)
                        fprintf(stream, "%g\t", list[i]);
                fprintf(stream, "...\n...\t");