[Solved] how to work on stl stacks inside functions c++? [closed]
Your fill function takes the parameter a by value, which means a copy is made. No changes to a inside the function will affect the variable you passed to the function. I suggest you make the function pass the object by reference: void fill(stack<int>& a, int cap) Now changes to a will update the object … Read more