+ 2
dynamic memory allocation, cannot be performed without using pointers. how?why?
2 Answers
+ 2
Because when you get a variable, you only get the value, not the variable reference. So you canât allocate memory to a number or whatever youâre trying to allocate to.
+ 3
In dynamic memory allocation you request the computer for memory. The compiler goes and sees what memory it has available. Assuming it has enough to give us, the operating system Will set aside the amount of memory requested and give us that memory's address so that we can use it. How do we store an address ? In a pointer !!
Hope it will help!!