Hello! I'm doing a program that reads from a text file in order to determine the size of the matrix (rows and cols) and respective content of the matrix.
I was wondering if something like:
int main()
{
int rows = FunctionThatReadsRows();
int cols = FunctionThatReadsCols();
int matrx[rows][cols];
return 0;
}
Would work? Or does it need to be dynamically allocated? I'm not sure if variables are initialized before any code runs? I need to work with the matrix throughout the program.
And if it does need to be dynamically allocated how should I do it? Thanks.