I have tried to do this, but it has only resulted in a segmentation fault.
Simply put, if tile is in board[i][j], you need to check the positions directly above, below, and on either side for 0. In other words, board[i+1][j], board[i-1][j], board[i][j+1], board[i][j-1].
But since you're saying you are getting seg faults, I'm betting you already do this.
There's another part to this. Along with checking these array elements, you also have to make sure that those indexes are not out of range. In other words, i+1 or j+1 must be < d and i-1 and j-1 must be >0. If you don't make these checks, you could be swapping with data outside of the array and corrupting data. It's an error, but it often won't throw an error and/or terminate the program.
This is probably a lot to do with your other question. As a side note, you can't simply locate the tile to move, locate the 0, and swap them. This would allow the player to swap opposite corners or any two non-adjacent tiles. These are invalid moves.
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)