I want to expand my comfort zone and start "reading from files more". In school, we are at multi-dimensional arrays. For this one program we have this week, its a 4D array and we need to print out the values at specific places (ie. x[1][2][3][4].
My question is: Why am I not able to put all 120 data members in a file then read that as a 4D array? I read that this process only works with 1D and 2D arrays. That my best solution would be to read as a 1D array and then reshape the data to a 4D ray, given I know the dimensions.
What is the benefit of doing it this way? It seems to me that the best course of action would be to initialize the array in int main(). (we have 2 programs like this example this week and that's how I did it for the first one, and seems like how I'll do it for this one as well).
This is more of a why is this so rather then a, please help me, type of question.