My code is an expression tree program, in which I make treenodes pointers and push them in the end all into the 1st spot of a stack, in which is declared in my header file of the program. I wipe all the treenode pointers with a recursive traversal. Is this enough to prevent a memory leak or can the stack be deleted as well?

Recommended Answers

All 3 Replies

Are you allocating the memory for the stack dynamically...?

Well im not declaring it with new in the header file, so I guess, but I'm not exactly sure. I thought maybe because it was in the header it would be different.

Actually didn't get what you wanted to say...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.