My code runs perfectly. but check50 says.... :( init initializes 3x3 board correctly
\ expected file to be of length 18, not 0 :( init initializes 4x4 board correctly
\ expected file to be of length 38, not 0

where am i going wrong?

1 Answer 1


Sounds like you lost the logging section of the supplied code. It was in the distro fifteen.c at line 80 after the call to draw():

// log the current state of the board (for testing)
    for (int i = 0; i < d; i++)
        for (int j = 0; j < d; j++)
            fprintf(file, "%i", board[i][j]);
            if (j < d - 1)
                fprintf(file, "|");
        fprintf(file, "\n");

That is how check50 verifies the result.

  • It is there, same like this. But still, it shows the same error Apr 2, 2017 at 15:10
  • The program is not producing the expected output in log.txt. It would be pointless to speculate on the dozens of ways that could happen. You'd have to include a pastebin link to your code, or edit your code into the question. Apr 2, 2017 at 16:16
  • What should I do then? Plz help. Apr 4, 2017 at 15:47
  • Include a pastebin link to your fifteen.c source or edit it into the question. Apr 4, 2017 at 20:15
  • What's pastebin link? is it a header? plz explain and help me edit my code Apr 5, 2017 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .