Whenever the first line of the map is populated a segmentation fault occurs, I would like to know 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");
}
}