1
Whenever the first line of the map is filled in, a Segmentation fault, I wonder why.
void newmap(int x, int y , int players){
int linha,coluna;
char **map = (char **) malloc(sizeof(char*) * y);
*map = (char *)malloc(sizeof(char)*x);
for(linha=0; linha<x; linha++){
for(coluna=0; coluna<y; coluna ++){
if(linha == 0 || coluna == 0 || linha == (x-1) || coluna == (y-1)) {
map[linha][coluna] = '*';
printf("*");
}
}
printf("\n");
}
}
Choose an answer that answered your question, it helps the community a lot
– Fábio Morais
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site (when you have enough score).
– Maniero