I'm trying to call one function inside other but I'm doing something wrong and I don't know what. The error was acused where I call the function verifica_sub.
void subtracao(Lista * lista_1, Lista * lista_2)
{
No_lista *aux1, *aux2, *aux_res_sub;
int aux_sub = 0, empresta = 0;
inicLista(&aux_res_sub);
aux1 = *lista_1;
aux2 = *lista_2;
while (aux1 != NULL)
{
aux_sub = aux1->info - aux2->info;
insereFim(&aux_res_sub, aux_sub);
aux1 = aux1->prox;
aux2 = aux2->prox;
}
aux_res_sub = verifica_sub(&aux_res_sub);
exibe(&aux_res_sub);
}
void verifica_sub(Lista * aux_res_sub)
{
No_lista *aux;
aux = *aux_res_sub;
while (aux != NULL)
{
if (aux->prox->info < 0)
{
aux->info = aux->info - 1;
aux->prox->info = aux->prox->info + 10;
}
aux = aux->prox;
}
You haven't included enough information to give a good answer to your question.
I did notice however that on the line in question you are trying to assign a the result of a void function to a variable. To do this you need to modify verifica_sub to return a value.
verifica_sub()
is used without having been prototyped, so the compiler assumes it returns int
. As it's result should be assigned to a pointer variable the compiler issues the warning you observe.
However as verifica_sub()
is defined to return "nothing", that is void
, assigning it to something doesn't make sense, and won't work anyway.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.