Apr 28 2009

Stack, using pointer, Data Structure.

This is a implementation of a Stack using pointers. The basic thing is the structure of tPilha is

constant MAXPILHA = 100;
tipo tPilha {
inteiro dados[MAXPILHA];
inteiro *topo;
};

Where *topo is a pointer to the first element in the stack. When you`re going to add a new one you verify if the stack is full, if it ins`t you put the data in a position in the stack and change the *topo. When removing, you decrement one in pointer *topo. Then it will reference the element that was there before.

(I had an enunciation but it was too big to translate)

stack with pointers implementation!

Regards,
Matheus

PS: You can see the enunciation in portuguese and then use google translate to translate it

Apr 02 2009

Stack, Data Structure.

Good Night,

What is Stack? Stack is a data structure of abstract data used a lot in computers, and it is based on the principle LIFO (Last in, first out). It has 2 basic functions, push and pop. It is simple right?

The professor told us to solve this:

* Implement all operations about stack.
* Implement a program that use your stack. The program must have a menu with: pop, push, clean, show stack, exit. Use switch.
* When the program show each element from stack it must show the position of the stack.
* The stack must have max size of 30. As a constant named MAXPILHA
* The stack is referenced by a global reference.

Stack, first implementation.

Regards,
Matheus

PS: I start translating “all” old posts. Maybe this old ones, don’t have all stuffs translated (like attachments in this one)