I want to know how to return the total number of elements in a stack on the screen. For example: I have a vector stack of size 10 and stacked 6 elements in it, it will have to return the total of 6 elements.
I have this code here, but it is 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??
}