O'Reilly logo

C Programming: Visual Quickstart Guide by Marc Liyanage, Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Static and Dynamic Memory

Static memory is what you have seen and used so far: variables (including pointer variables) and arrays of fixed size. You can work with these blocks of memory in your program code using their names as well as their addresses (see Chapter 9, “Working with Pointers”).

With static memory you define the maximum amount of space required for a variable when you write your program:

char a[1000]; // Fixed at runtime.

Whether needed or not, all of that memory will be reserved for that variable and there is no way to change the amount of static memory while the program runs.

Dynamic memory is different. It comes in blocks without names, just addresses. It is allocated when the program runs, in chunks from a large pool that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required