2
I want to know how to return on the screen the total number of elements in a stack. For example: I have an array stack of size 10 and stacked 6 elements in it, will have to return me the total of 6 elements.
I have this code here, but it’s not returning me correctly:
void pilha_imprime (tipo_pilha *pilha)
{
int i;
for (i=pilha->topo-1; i>=0; i--)
printf(“%f\n”, pilha->pilha[i]);
return i; //tem retorno i??
}