Types of Memory

You will learn about the two types of memory of a program in this lesson.

We'll cover the following

Stack memory

In running a C program, there are two types of memory that are allocated. The first is called stack memory, and allocations and deallocations of it are managed implicitly by the compiler for you, the programmer; for this reason, it is sometimes called automatic memory.

Declaring memory on the stack in C is easy. For example, let’s say you need some space in a function func() for an integer, called x. To declare such a piece of memory, you just do something like this:

Get hands-on with 1200+ tech skills courses.