My program treats matrixes reading them from a file. Their size is given in the beginning of the file. How to allocate memory for the matrix?
For this you need to place your matrix not in the stack, but in a heap. To allocate memory for objects in the heap, use the operator new. You can allocate memory for the matrix by several blocks. To do this you need to allocate memory for an array of string pointers. Then for each pointer using the new operator allocate memory for the string. The syntax for using such a matrix is similar to the syntax of regular matrix: