[SOLVED] Segmentation fault
I'am writing a program that performs the knight's tour i.e. moves a knight around on a chessboard in such way that the knight visits every square exactly once. The program is a bit messy, I'll make it more concise and readable when I finish. For now it does just the first move, but putting it in a loop should do the rest. If I run it I can see the first move performed (that is a zero at the top left of the board) However it's not an allowed move for knights in chess. To fix that I need to add the condition "j != i" in the if at line 69. It should be: if( j != i && r + i < 8 && c + i < 8 ) But if I run the "fixed" program, the compiler gives me a segmentation fault. The only change I make is this "j != i" Any idea why I can't do that? https://code.sololearn.com/cXfBqgmoIRT3/?ref=app