Incremental Union?

Posted by cam on Stack Overflow See other posts from Stack Overflow or by cam
Published on 2010-04-21T11:24:59Z Indexed on 2010/04/21 11:33 UTC
Read the original article Hit count: 125

Filed under:
|

I'm trying to describe a Sudoku Board in C++ with a union statement:

union Board
{
    int board[9][9];
    int sec1[3][3];
    int sec2[3][3];
    int sec3[3][3];
    int sec4[3][3];
    int sec5[3][3];
    int sec6[3][3];
    int sec7[3][3];
    int sec8[3][3];
    int sec9[3][3];     
}

Would each section of the board correspond with the correct part of the array? IE,

Would sec4 correspond with board[4-6][0-3]? Is there a better way to do this sort of thing (specifically describing a sudoku board)?

© Stack Overflow or respective owner

Related posts about c++

Related posts about union