I need to scan some integers into a 2D array (square matrix). After running the file, the matrix will be entered in this form (line by line):
EDIT: My biggest problem is determining the size of the array without losing any of these input lines.
4 4 1 1
4 4 1 1
3 2 2 3
4 1 1 1
The code should work for any nxn matrix. I then have to be able to do some arithmetic with the matrices.
I already wasted many hours trying to figure this out and it's really depressing me that I made 0 progress. I thought that, to figure out the matrix size, I need to scan the first line, but when I scan the first line I lose those integers!? I think I'm also supposed to use pointers.
I have almost no experience with C, maybe someone with more experience can show me what the code should look like so I can learn.