![]() |
Segmentation Faults with 2D-array
I am trying to write a program to solve simple mazes but somehow I can't get it to put the maze in a 2D-array, this is my code:
Code:
int **doolhof;readIn is supposed to read in all information relevant to solving the maze such as the maximum hight to be able to step through a gate represented by ^ and -2, the minimum size to be able to step over a flowerbed represented by % and -3. Personen is the size of the team, lengte containts the size of each team member. The four types of team members are: 0 these can step over flowerbeds and walk through gates. 1 these can walk through gates. 2 these can step over flowerbeds. 3 these can not step over flowerbeds nor can they walk through gates, they can only walk on the grass, represented by '.' Get maze actually fills the 2D array with numbers representing the obstacles in the mazes. Places where everybody can walk are represented by column*row+1, this to facilitate the use of Dijkstra's algorithm later on. Whenever I try to run this program I get a segmentation fault while reading in the last lines of the mazes. I can't imagine what goes wrong especially as reading in the first few lines doesn't seem to be a problem. I hope anyone can help me. |
Re: Segmentation Faults with 2D-array
If anyone could tell how I can switch HTML code from off to on I would be grateful, cause this doesn't look very inviting.
|
Re: Segmentation Faults with 2D-array
Quote:
|
Re: Segmentation Faults with 2D-array
Quote:
|
Re: Segmentation Faults with 2D-array
Solved, the code seems to work for now, here it is:
Code:
#include <stdio.h> |
| All times are GMT +5.5. The time now is 09:36. |