Yeah you're right...ok...as you see in the input file , the values in the first line ais like this : 3 0 0 9 0 0 2 0 0
it means that in array (matrix) the values should be like this :
and so on...until matrix=0...(as we have in input file)
but what I see is like this :
and so on until the last one....and the interesting thing is that the size of the matrix that I defined in my code is matrix...but when I debug the code it's like that :
matrix!!!! I mean the last element of matrix is in matrix with "48" for the value...
I hope that I've explained clearly...if it's not obvious tell me to explain more...
Your counter is being increment by 1 too many because you increment it even when trying to read beyond the last line; you should only increment it when you get a complete line of values. You are setting the number of columns to the length of the final line read in, but this is wrong as there are more characters than actual digits in the line. And finally, you are setting the values in your matrix to each successive character in the input line, rather than tokenising the string into the successive digits and converting them to integers.
One of these days I'm going to think of a really clever signature.