I'm not sure if I got the question correct. How about change the address of stack to point to top and then modify the push,pop functions to retrieve values as
push(int a){ stack[--top] = a; } int pop(){ return (stack[a++]); } I know there is serious limitation of not able to add elements without removal, and the size of the stack is limited by no. of elements before the modification. this is an idea, but we are not working on data, so, not sure if this is acceptable. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/1EnHa1NZCisJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.