Raysa Oliveira

Stack is one of the structures of data, where its basic idea is that all the access to its elements is made from the top. In this manner, when a new element is introduced in the stack it starts to be the element of the top, as well as all the removal of the stack is initiated solely for the top. The elements of the stack alone can be removed in the inverse order to the order where they had been introduced: the first one that it leaves finishes is it that it entered (to describe this strategy acronym LIFO is used – last in, first out). The stack is composed for five operations that disponibilizam the manipulation and the access to the information of the same one. The operations are: to create, to insert, to verify, to remove to eliberar. The operation to create stack consists basically of inicializar it as NULL, that it means null. It is important to remember that for each bred stack its inicializao is essential, therefore this null element has the function to inform the end of its stack.

The function to insert, objective to pile up a new element in the top, for in such a way is necessary that a space is placed in the memory and that, of preference, either a dynamic allocation, therefore thus you will only use the amount of memory that really necessary. The function to verify, aims at to inquire if the stack is empty. The operation to remove, unpiles an element of the top, that is, it removes the top of its stack. finishes it operation is to liberate the used memory for the use of the stack, generally is made with the function free (). The structure of data (stack) widely is used in elaboration of programs and, an example of known use of stack more is the proper stack of execution of language C. The local 0 variable of the functions are made use in a stack and a function alone has access the 0 variable of the function that is in the top, not being able to have access the local 0 variable of other functions.