There a few different areas of memory, where the C/C++ virtual machine is concerned.
1. Global and static variables are held in a "data" segment and a initialized to zero.
2. Local variables and function return addresses are held in "the stack".
3. The Heap is a free section of memory that programs can request blocks of memory from.
When you add an extra 16Gbytes of RAM to your computer, that's available in the heap.
You request memory from the heap by calling malloc(), and give it back with free(). If there's nothing to give, malloc() returns NULL, and you're expected to check for that and deal with it.
Asking for 100 bytes with malloc(100), then asking for the value at offset 1000, y, is a serious error and is called a buffer overflow.
if you care, this is C code. C++ usually uses new instead of malloc. C++ may use malloc, and sometimes will because it has the 'realloc' function (and lesser but also usefull calloc) which are not matched anywhere in c++ (you can do the tasks but its more than 1 function call in c++).