1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
int data[4][4] =
{
{1, 2, 3, 4},
{1, 2, 3, 4},
{0, 0, 2, 3},
{1, 2, 3, 1}
};
bool ColPrint[4] = {false,false,false,false};
int row, col;
for (col = 0; col < 4; ++col)
{
for (row = 0; row < 4; ++row)
{
if( data[row][col] == 0 )
break;
}
if(row>=4)
ColPrint[col] = true;
else
ColPrint[col] = false;
}
for (row = 0; row < 4; ++row)
{
for (col = 0; col < 4; ++col)
{
if(ColPrint[col] == true)
// print data[row][col]
}
}
| |