lundi 3 juin 2019

How to understand this line of code about int array in c++? [duplicate]

This question already has an answer here:

so I got a line of code here, which is to check the sudoku game is valid or not.

I try to use cout to understand what it is, but there no result print out.

   if(board[i][j] != '.'){
      int num = board[i][j] - '1';
      if(row[i][num]++) return false;
      if(col[j][num]++) return false;
      if(boxes[i/3][j/3][num]++) return false;
   }


so what's this line of code means?

if(row[i][num]++) return false

what condition is this if statment comparing? a number? And what's ++ means follow after?

Aucun commentaire:

Enregistrer un commentaire