Dynamic Memory Allocation
Why do we need dynamic memory allocation?- When the size of the array is passed as argument to the program
IMPORTANT !!!After you finished using the variable which you dynamically allocated, FREE the memory:void free(void *);Usage:free(vec);If you don’t - you will experience Memory Leak - no free memory !
Dangling Pointer - a pointer that points to a memory that is unreserved. (Example: allocate pointer and then reference to another location).