Instead of using a knight, we are going to use a bishop, a piece that moves diagonally. If you are familiar with chess, you've probably already concluded that this is impossible, since a bishop on a white square cannot occupy a black square. But what about a special bishop? A common mistake is to move a bishop diagonally and capture an opponent's piece 1 square off from the diagonal, which is normally an illegal move. But let's suppose that this is allowed a finite number of times. We'll call this piece the super-bishop.
Make a C program to attempt to solve the super-bishop's tour. It should take a board size, given as the first (optional) argument to the command-line program. If unspecified, this should default to 8. We assume that the board is always a square, so 8 means 8x8. The second (optional) argument is the number of times the bishop can jump to a square off the diagonal. If unspecified, this should default to 1. Check that the arguments specified by the user make sense. Zero would be a dull, but valid, value for the second argument. Zero would be an invalid value for the first argument, though.
Store each visit as an integer, using 1 as the starting location. (Hint: use a special value like 0 to mark un-visited squares.) Set the starting row and column such that they can easily be changed. While you may use 1,1 as the starting point, it should be easy to change the starting point to something else. For example, you could have the user specify this as optional 3rd and 4th arguments.
You will need to allocate memory for the board, based on the size the user specifies. Any memory allocated should be freed when you are done with it. Also, the best way to approach a problem like this is to use recursion. Remember that passing by reference means that there is only one copy of the data, and for this problem, you will need to keep redundant copies of the data. That is, if you move the piece now, how do you know you won't want to undo this move later? In a recursive solution, you would keep a copy of the current board (i.e. the computer implicitly keeps it for you on the stack).
Output the solution to standard output. If a solution cannot be found, output the partial solution that comes the closest.