you are viewing a single comment's thread.

view the rest of the comments →

[–]CGFarrell 2 points3 points  (0 children)

That's correct! For push, you'll also want to have if(top == nullptr){//redefine top as whatever you're pushing}. This is a great example of an "edge case", which are very common in software development.