// @topic W09-2-030 IntStack class using fixed-sixe array
// @brief class IntStack implementation
#include "int_stack.h"
IntStack::IntStack()
: // constructor initializer list
top_of_stack( 0 )
{
}
void IntStack::push( int value )
{
memory_block[ top_of_stack ] = value;
++top_of_stack; // stack maintenance
}
void IntStack::pop()
{
--top_of_stack; // stack maintenance
}
int IntStack::top()
{
return memory_block[ top_of_stack - 1 ];
}
int IntStack::size()
{
return top_of_stack;
}