It looks like you never set grid[row][column] to true in the uncommented portion of the code.
Also, can you explain the expected output? Now (maybe related to my last statement), I see nothing output (after commenting the "test first loop" type statements. This leads me to believe that grid[j] is never true.
Also, please please please don't use global variables (grid here is global).