0
So guys, I created this struct
typedef struct{
int inicio;
int tamanho;
int fim;
char *elementos[50];
}Fila;
And I intend to create a char vector, just as I have created several times an integer vector. Only it is not working at the time of implementation of the queue creation function.
Fila* criarFila(int tamanho){
Fila* novaFila = new Fila;
novaFila->tamanho = tamanho;
novaFila->inicio = -1;
novaFila->fim = -1;
novaFila->elementos = new char[tamanho];
return novaFila;
}
When it comes to compiling, it makes the mistake:
listar.cpp:66:22: error: incompatible types in assignment of ‘char*’ to ‘char* [50]’
novaFila->elementos = new char[tamanho];
^
Does anyone understand why you are making this mistake?
Try to trade
char *elementos[50];
forchar elementos[50];
– João Sobral