marwk@levels.sait.edu.au (01/02/91)
> int maxrows, maxcols; > char **array; > > maxrows = ...whatever... > maxcols = ...whatever... > > array = (char **) malloc(maxcols * sizeof(char *)); Use maxrows in the above line. > > for(x=0; x < maxrows; x++) /* !!! do not change this line */ > array[x] = (char *) malloc(maxrows); Use maxrows in the above line Your first malloc allocates MAXCOLS column pointers. The second allocates MAXROWS rows for MAXROWS columns, not MAXCOLS columns. The usual matrix use requires array[r][c] to refer to the r'th row and the c'th column - the changes above will fix this. Perhaps your UNIX program has a bug it in now? ;-) I have tested my solution with TC 2.01. Ray