For my assignment I have to do mathematical operations on array I'm reading in from a text file. And it has to be dynamically allocated because we don't know the size of the matrix although we do know that it will be square.So I've managed to read in the array and I've put in the code so that it knows the rows and columns at run time. But my professor wants us to use contiguous arrays and allocate the matrix like this
float* A = (float*) malloc( n * m * sizeof(float) );
But I don't know how to read in the values from the text file into this array. What would I do use a for loop or something? And how would I access the elements in the array later on?