Passing Stack to Function
c++, function, stack
Solution
This should suffice:
void displayStack(const Stack<char>& stack);
Problem
So I'm playing around with stacks and I've filled one in my main function, but now I want to pass it to my other functions so I can traverse through it. I'm not sure what kind of data type to put into the prototype though so that it accepts it. Suggestions? Here's what I have: Main.cpp ``` #include <iostream> using namespace std; #include "stack.h" void displayStack(char &stackRef); int main() { Stack<char> stack; stack.push('a'); stack.push('b'); stack.push('c'); return 0; }; void displayStack(char starRef) { // Cannot Get here - Errors! }; ``` It's telling me I have too many arguments and it doesn't match argument list.