I cannot print the path

code-https://ide.codingblocks.com/s/326666

I don’t know where am I going wrong. When I visit a cell I mark it 1 and the places which it blocks I mark -1.
Then this is done for every row. I also figured that because they are horses they can all stay on the same like so the number of ways to do that would be equal to the number of rows or horses so I add that to the total count.

print the output according to the format .
also form a separate function to check if placing is safe
also for n = 3, the answer should be 36
you can refer to this
reference

Hello, I updated my code to this.


Instead of using an extra board array I tried to use backtracking. I get the right answer for 2 and the printed paths were also correct but I get 54 for input 3.
Please check!