> As far as I know, this one of the ways of declaring a 2D matrix in C. ... The 
> initialization happens in another nested for loop.

So far you have not shown the code that establishes a value for each
 matrix[row][j]  when  0 <= j < size  and  0 <= row < size.
Memcheck's complaint is about the _use_ of an uninit value in a call to printf()
which appears at line 42 of matrix1.c.  (And furthermore, sizeof that uninit 
value
is 8, not 4; although this may be an artifact that is internal to _itoa_word.)
As a partial clue, memcheck tells you that the space for the uninit value
was created by malloc() called from line 28 of matrix1.c.  Whatever is
on lines 29 through 41 did not store anything into [some portion of] that space.

Hint:  Immediately after the malloc, printf  row  and  matrix[row] .
Immediately after each assignment in the nested 'for' loop which you claim 
initializes
the matrix, then printf the _address_ of the entry which was intialized on that 
iteration.
Immediately before the printf on line 42 of matrix1.c, insert another printf
which prints the _address_ of anything whose value is printed by line 42.
Then compare addresses.

-- 

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to