Check out this correction;
distancesSG = calc_Distance(Pos_XS,Pos_YS ,Pos_GX,Pos_GY);
distances = (cities[i][j],cities[i][j+1], distancesSG);
Check out this correction;
distancesSG = calc_Distance(Pos_XS,Pos_YS ,Pos_GX,Pos_GY);
distances = (cities[i][j],cities[i][j+1], distancesSG);