Implementation of the stack data structure using functions