Why this part of code cause RE?


  • -1
    W

    I was writing this piece of code on OJ and it causes Running Error. I don't know why it happens. Does anybody know? Thanks!

     bool *a=new bool [9];
        for(int j=0;j<9;j++)
            a[j] = 0;
    

    I changed it to bool a[9] = {0}; later and It is AC. I am so confused.


  • 0
    C

    I presume that the RE is coming from somewhere else. just appended your code section to beginning of my solution to see if it's really the case and guess what it passed.
    Best thing is to get the input (sudoku puzzle) and try it along with your tests.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.