two dimensional integer array: sudoku with empty space

Hello all,

I want to write a function which solves Sudoku and for testing I declared a two dimensional array as follows

int sudoku[9][9] = {
{2,' ',' ',8,' ',4,' ',' ',6 } ,
{' ', ' ', 6 , ' ', -1, -1, 5 , -1, -1} ,
{ -1, 7 , 4 , -1, -1, -1, 9 , 2 , -1} ,
{ 3 , -1, -1, -1, 4 , -1, -1, -1, 7 } ,
{ -1, -1, -1, 3 , -1, 5 , -1, -1, -1} ,
{ 4 , -1, -1, -1, 6 , -1, -1, -1, 9 } ,
{ -1, 1 , 9 , -1, -1, -1, 7 , 4 , -1} ,
{ -1, -1, 8 , -1, -1, -1, 2 , -1, -1} ,
{ 5 , -1, -1, 6 , -1, 8 , -1, -1, 1 } ,
};

but I get the error message
'empty character constant' in every line of code.

I would really appreciate help.

Thank you very much!!!!

Are both -1 and ' ' used for empty cells? I don't get an error when I try your code. Your error message seem to suggest you have '' with no space in between.

Last edited on
Hello, yes -1 an '' are used for empty cells. The code works now but I didn't get why.

Thank you for your help.
Topic archived. No new replies allowed.