Question:
stack as a function parameter in c++?
mchstigger04
2006-11-05 13:55:58 UTC
i'm just learning implementation with stl stacks and queues and i'm not really familiar with them yet. can you make a function that takes an stl stack or queue as a parameter??? if so whats the syntax? the function will take in the stack and push a few values and either return the stack or pass it by reference. is this possible?
Three answers:
Mark aka jack573
2006-11-07 01:05:00 UTC
My opinion would be that it is a normal class / object, and you should be able to pass it as a parameter.



I would be more inclined to pass it as a pointer to the stack, rather than the whole stack itself. Therefore, you would be passing be reference.



I do not think you would have to return the stack, as you could change the contents whilst in this function, and upon returning from the function the stack that you passed as reference would contain the changes made in the function.
creasong
2016-12-17 09:47:05 UTC
thrilling question. could be if we've a team of overloaded purposes with some experience matching singnatures then we would even see no count number if or no longer they could be grouped as a single functionality probably with default arguments. consequently, one functionality with default arguments will represents each and all the needs. consequently, coding efforts would shrink. although, i've got faith that is quite trivial
Webballs
2006-11-05 13:57:30 UTC
Try google.com and put in stack function. There is an example that you might like.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...