Listing 3 Out-of-line functions for the stack class

// stack1.cpp
#include "stack1.h"

void Stack::push(int x)
{
   if (ptr < size)
      data[ptr++] = x;
}

int Stack::pop()
{
   if (ptr > 0)
      --ptr;
   return data[ptr];
}

// End of File