0
How do I make a function that returns the first element inserted of a pile?
For example:
i add whole values to my size 5 vector stack.
3
4
5
6
7
You have to return the first element inserted in the stack, in this case the 3.
I made this one:
float retornatopo ( struct Pilha *p ){
if(p->topo < 10)
return p->pElem [p->topo - 1];
else
return -1;
}
But this return to the top of the stack, I need the first element inserted (FIFO).
first in last out - FIFO and last in first out - LIFO
– Edilson
So I don’t intend to remove the element, just print on the screen the first element inserted.
– André
The first element would not be pElem[0]?
– Gabriel Faria