Subject: dynamic array allocation I recommend that you use dynamic linked lists for assignments. On the other hand, I'd rather that you focus on getting the assignment to work, than to be stuck on data structure bugs. If you must absolutely avoid linked lists, then you should at least use a dynamically allocated data structure. The following shows one scheme that works in C... ----- cut here ------ typedef struct point { short coord[2]; } Point; typedef Point *PointArray; /*------------------------------------------- */ main(int argc, char **argv) { int np=10, ne = 10; PointArray pts; /* grab number of points from command line */ if (argc == 2) sscanf(argv[1], "%d", &np); pts = (PointArray) calloc(np, sizeof(Point)); random_pts(pts, np, 20, WINSIZE-20); *** etc *** /*------------------------------------------- */ void random_pts(PointArray pts, int np, int low, int high) { int i,j, found; i = 0; do { pts[i].coord[X] = (short) (rand()*(high-low)/RAND_MAX + low); *** etc ***