2

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) ...


1

Use like if (y > 0 && j[y-1][x] == 0) and if (y < d-1 && j[y+1][x] == 0) (equivalent checks for x on the other lines) to prevent this from being evaluated for invalid coordinates.


1

It is not complaining about the compile, that gives a :). It is complaining that the board is not initialized correctly. Remember from the check50 section of the spec: Note that check50 assumes that your board’s blank space is implemented in board as 0; if you’ve chosen some other value, best to change to 0 for check50's sake. It looks like you have ...


1

These are all syntax errors. In the case of the first two, it's an incorrect initialization, more or less. I'll explain. in order to use the {...} technique, you have to do this at the same time as the array is created. int array[] = { 3 , 5 } would create an array of 2 integers and populate them with 3 and 5. However, int ...


1

If they are not swapped, the puzzle is not solvable. You can review the Wikipedia article about the game to learn about the arcane mathematics "happening behind the screen".


1

The error states that if non of your for loops are executed then function is not able to return any value to the function call. Reaching the end of a non void function without returning a value is undefined behavior. In this case, say for example, that the in the first for loop, the initial condition is not satisfied, then the return statement is not ...


Only top voted, non community-wiki answers of a minimum length are eligible