Im looking for a way to fill up a multi-d array with numbers gotten from a text file. I have an array(?) dynamically created, but im not sure how to make it multidimensional.
basically the text document has a set of numbers, user input decides the amount of columns and rows of a matrix, and i need to fill that matrix with numbers from the text document. Any help is appreciated
ptrm2 = (int*)malloc(size2 *sizeof(int));
malloc, either you allocate an array of pointers for the rows, and then allocate each of them separately for the columns, or you allocate a single-dimensional array with as many cells as you need in total and then use arithmetic to map multi-dimensional coordinates to the correct cell (e.g.,row * height + column).