How do I make a function return the first element of a stack ?
For example:
I add integer values in my vector size 5 stack.
3
4
5
6
7
You have to return the first element inserted in the stack, in this case the 3rd.
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 the top of the stack, I need the first element ( FIFO ).