stack implementation using an array