#include #include #include #define NUMBER_OF_ROWS 10 #define NUMBER_OF_COLUMNS 10 int readArrayFromFile(int rows, int columns, double array[rows][columns]); void printPointsArray(int rows, int columns, double array[rows][columns]); void init(int pointsArrayRows, int pointsArrayColumns, double pointsArray[pointsArrayRows][pointsArrayColumns]); int main(int argc, char const *argv[]){ double **pointsArray; int row; pointsArray = (double **)(malloc(NUMBER_OF_ROWS * sizeof(double *))); for (int i = 0; i < NUMBER_OF_ROWS; ++i){ pointsArray[i] = (double *)(malloc(NUMBER_OF_COLUMNS * sizeof(double))); } init(NUMBER_OF_ROWS, NUMBER_OF_COLUMNS, &pointsArray); printPointsArray(NUMBER_OF_ROWS, NUMBER_OF_COLUMNS, &pointsArray); printf("Done! Press any key to exit.\n"); scanf("%d", &row); } int readArrayFromFile(int rows, int columns, double array[rows][columns]){ FILE *pointsBinaryFile; pointsBinaryFile = fopen("data.bin","rb"); if(fread(array, sizeof(double), rows * columns, pointsBinaryFile) != rows * columns) { if(feof(pointsBinaryFile)) printf("There were usefull info after the end of file.\n"); else printf("File read error.\n"); return 1; } fclose(pointsBinaryFile); return 0; } void printPointsArray(int rows, int columns, double array[rows][columns]){ int row, column; for (row=0; row