your syntax seems correct. If you replaced the a, b, c, d, etc with constant numbers I believe it will work.
However, since you're initializing the array, it has to be done with constants, not variables. If the a, b, c, d, etc are all variables, then you have little choice but to do this
CODE
puzzle[0][0] = a;
puzzle[0][1] = b;
// and so on
puzzle[3][2] = n;
puzzle[3][3] = o;
this would be done somewhere further down in your main function.
If you're asking for the algorithm to determine the values of the a to o variables, well here's how I would do it in a simple manner
fill in the puzzle row by row
have a 'set' of numbers 1 to 4. randomly pick numbers out of this set and fill in the first row. (if you've picked a number, it can no longer be selected for the same row).
repeat for each row. however, additional constraints apply.
- if any of the above rows have the same number in the same column, put the number back and randomly select again.
- if any in the same 2x2 square have the same number, put the number back and select again
Assuming that all sudoku puzzles have a solution I believe that the algorithm should work. you probably try to generate a couple of thousand solution to test the theory.
since we keep on putting back the numbers and reselect when we hit the constraint, this might be a wasteful algorithm as we have to try many times. However, it is simple. I haven't read up on the popular algo used so I'm sure there are optimizations available.
figuring out how to check the constraints correctly in a generic manner that can be easily extended to 9x9 grid might be challenging.
figuring out which numbers to 'hide' so that the puzzle solver can take a reasonable shot at it is also challenging.