Queues and Stacks and References

I'm getting a segfault on an issue having to do with getting references to the top elements in queues and stacks. I'll focus on the stack here. I want to determine if the segfault occurs because of improper syntax or due to some other reason in the code.

When i pop the top element of stack (order) of type path, i set a pointer to it.

*square=order.top();//I want square to point to the path element so I can access it's details

Keep in mind that *square points to another variable of type path before this.

I then generally end up popping it off the stack but if i'm not mistaken, square should still have access to the data.

链接地址: http://www.djcxy.com/p/79862.html

上一篇: 堆栈和队列

下一篇: 队列和堆栈和引用