Implementation of Dijkstra's algorithm of pathfinding in C