void isConnected (Graph graph, int curCity, int secondCity, int curDepth){ if ((curCity == secondCity) || (graph[curCity].firstRoadLink->city == secondCity)){ printf("They are connected !\n"); }else{ Link curLink = graph[curCity].firstRoadLink; if (curLink != NULL){ while (curLink->nextCitybyRoad != NULL){ curLink = curLink->nextCitybyRoad; printf("curDepth = %d\n", curDepth); isConnected(graph, curLink->city, secondCity, ++curDepth); } } } }