Why are the two judgment expressions in if written in two lines

 while (!is_empty()) {
    
    
        p = dequeue();
        show_p(p);
        if (p.row == MAX_ROW - 1  /* goal */
            && p.col == MAX_COL - 1)
            break;
        if (p.col+1 < MAX_COL     /* right */
            && maze[p.row][p.col+1] == 0)
            visit(p.row, p.col+1);
        if (p.row+1 < MAX_ROW     /* down */
            && maze[p.row+1][p.col] == 0)
            ...
 }

Today I stumbled upon the benefits of writing this way. When the IDE is debugging, it is quite obvious which step the source level step stays at.

Guess you like

Origin blog.csdn.net/qq_30549099/article/details/104693896