In this section, we will discover how the windows manage the memory.
We have multiple ways to allocate memory addresses so let’s look at them.
#include <stdio.h>
#include <Windows.h>
int main()
{
//This will allocate a memory with 100 bytes of space
PVOID pAddress = malloc(100);
if (pAddress != NULL)
{
printf("Address Allocated: %p",pAddress);
}
return EXIT_SUCCESS;
}

Notice that we used the malloc function to allocate 100 bytes of space in memory.
#include <stdio.h>
#include <Windows.h>
int main()
{
PVOID pAddress = HeapAlloc(GetProcessHeap(), 0, 100);
if (pAddress != NULL)
{
printf("Address Allocated: %p",pAddress);
}
return EXIT_SUCCESS;
}

As observed we successfully allocated the 100 bytes of space.
Now, take a look at the HeapAlloc function.

The HeapAlloc allocates a block of memory in the heap.
The Function takes three parameters.