Subj : Re: stack question...? To : borland.public.cpp.borlandcpp From : John F\(dot\) Date : Thu Sep 15 2005 08:45 pm more elegant (not efficient, since AFAIK it is most efficient using global variables) it would be utilizing structures typedef struct Stack_s { int* stk; int n; int pc; }Stack_t; and static Stack_t inside a handling-function, maybe with sth like int StackHandling(enum Action, int Parameter) { static Stack_t MyStack; static int Init_Flag, Returnvalue; switch(Action) { case INIT: //parameter used as count //Initcode break; case PUSH: //parameter used as ..... } return Returnvalue; } and push(int y) { StackParam_t P; P.Value=y; StackHandling(PUSH, P); } .... alternatively you define your Stack outside the library, then you ge sth like push(Stack_t* MyStack, int ToPush) .... freestk() { free(stk); } should be: freestk() { free(stk); stk=NULL; } and check failure of malloc!!!! regards John .