Purchase Solution

C++ stack, Memory Problem

Not what you're looking for?

Ask Custom Question

I have created my stack template (not using stl). my methods work for the testing file.

Even though the program runs correctly, there is a memory problem somewhere in the program and I can't figure out what I have done wrong. I have allocated new memory for my stack and I'm deleting it as well, but still there is a problem somewhere.

See the attachments.

Purchase this Solution

Solution Summary

This solution explains potential issues with an improperly-working stack template and proposes solutions for fixing those issues so that the programs will work properly.

Solution Preview

The error produced by this program is a little misleading. Various compilers will print out different messages but they will all say something similar to "possible corrupted stack". The "stack" being mentioned in this error message is NOT the stack class that is being implemented by the program. Instead, it is the heap used for memory allocation.

The Stack class constructor is correctly allocating a chunk of memory as an array. The destructor is correctly deleting that same ...

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic Networking Questions

This quiz consists of some basic networking questions.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.