Simple pathfinding using backtracking. Not always the shortest path but a good compromise between speed calculation and short path.
x -> start position
o -> goal
# -> obstacle
. -> empty
x . . # . . . .
# . . . . . . .
. . . # . . . .
. . . # . # . .
. . . . . o . .
You can add rows, columns and change the position of the differents characters.
* -> path
x * * # . . . .
# . * . . . . .
. . * # . . . .
. . * # . # . .
. . * * * o . .
Compile and execute the script with the command.
gcc *.c && ./a.out
[!] Doesn't work on windows (cause I use unistd lib). Please execute with WSL or in VM if you are on windows.