0
Why is this showing compilation error?
Help me sort this out? https://code.sololearn.com/cIPKR7F2LGFM/?ref=app
3 Answers
+ 2
Seems like sololearn decided to just display "Compilation Error" instead of showing a long chain of errors I saw when I ran it on a different compiler.
The main problem is that showstack returns void (nothing).
+ 3
showstack() returns void, so you are trying to print a nonexisting value when saying
cout << showstack();
You should call the function on its own, i.e.
cout << "Stack contains:" << endl;
showstack( s );
+ 1
Your code is perfect I think sololearn doesn't provide stack header file that's why it is giving error.
I run your code on codeblocks it runs perfect.
Your code is perfect just try any other compiler.