Having the struct
struct bloco {
bloco () : real(), marcado('.'){}
char real;
char marcado;
};
When I try
void tabuleiro (int lado, int mina){
...
bloco tab[lado][lado];
...
for (i=0, j=0; lado>i; i++){
for (j=0; lado>j; j++){
tab[i][j].real = '.';
}
}
...
jogar(tab[lado][lado]);
return;
}
And in the play function I have
void jogar(bloco tab){
tab[x][y].marcado = 'M';
}
I get the message
no match for 'operator []' (operand types are 'block' and 'int') tab [x] [y] .marcado = 'M';
As far as I understand, this means that I did not pass "tab" as an array, so I tried to solve with:
void jogar(int lado, bloco tab[lado][lado]){
tab[x][y].marcado = 'M';
}
That gave me the following message
error: use of parameter 'side' outside function body void play (int side, block tab [side] [side]) {
I just wanted to pass the array of structs created in one function to change it in the other, but I do not know how to: (