0
I’m trying to make a minefield in c using ncurses. h and when I’m going to do the vector of "bomb objects" Linux says it can’t find the memory space in which the values of the bombs are:
PS: no I can’t use c++
typedef struct Bomb
{
    int x, y;
} Bomb;
Bomb* setBomb(int i){
    Bomb* newBomb = malloc(sizeof(Bomb));
    srand(time(NULL) / i);
    newBomb->x = rand() % i * (i + 1);
    srand(time(NULL) * i);
    newBomb->y =  rand() % i * (i + 1);
    return newBomb;
}
Bomb** setBombs(WINDOW* win, int amountBombs)
{
    Bomb** bombs = malloc(sizeof(Bomb) * amountBombs);
    for(int i = 0; i < amountBombs; ++i)
    {
        bombs[i] = setBomb(i);
    }
    drawBomb(win, bombs, amountBombs);
    return bombs;
}
int drawBomb(WINDOW* win, Bomb** bomb, int amount)
{
    for (int i = 0; i < amount; i++)
    {
        mvwprintw(win, bomb[0]->y, bomb[0]->x, "O");
    }
}