Putting numbers in a Matrix.
hello,
I want to build a function in C that create a matrix with values of number in it.
the user's input is the dimensions of the matrix (height and width) and then he is entering the matrix.
for example, the user enter a matrix of 4 and 5 (4 is the number of columns and 5 is the number of rows).
then he is entering the following matrix:
-3 1 -4 2 -5
3 5 -8 8 10
6 -5 20 -3 4
-7 3 2 16 -5
building the matrix by the number of columns and rows i know how to do. but how can i scan the user input of the matrix and actually put each number in the right place in the matrix i create?
to be more specific, how does the scanf order should look, and how can i run it in loops in order to put each number in the right place? (for example how can i scan the number 1 in the user input and then put it the cell mat[0][1]?)
thank you for your help in advance...