Chapter 10. Managing Memory

So far, every one of this book's programs has used a fixed amount of memory to accomplish its task. This fixed amount of memory was known and specified (in the form of a variable) when the program was written. These programs could not increase or decrease the amount of memory available for the storage of user data during runtime. Instead, such changes had to be done in the program's source code file, and the program had to be recompiled and re-executed.

But the real world is dynamic, and so is the input that has to be processed by a C program (for example, users need to be able to submit a varying amount of text in most applications). To handle situations where the amount of data to be stored is not known in advance, you have to use dynamic memory in your C programs.

Dynamic memory allows you to create and use data structures that can grow and shrink as needed, limited only by the amount of memory installed in the computer they're running on. In this chapter you'll learn how to work with memory in a flexible manner.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset