I red the first line of the file and it gave the rows (rows) and columns (cols) using fscanf(). There is a global variable called fpin1, that's the file I'm reading from. The last line is chopped off.
Code:void readImg(char Image1[MAXROW][MAXCOL],int rows, int cols) { printf("rows: %d cols: %d", rows, cols); int i; for(i = 0; i < rows; i++)//if the condition is <= it works as expected { fgets(Image1[i], MAXCOL, fpin1); printf("%s", Image1[i]); } }