Dynamic Memory Allocation using new and delete Operators in c++
This video tutorial teaches you how to do dynamic memory allocation in c++ using new and delete operators.
check out what is dynamic memory allocation and what is the need of it at
https://www.youtube.com/watch?v=X_7VIkTPHBo
you will learn how to use new and delete operators in c++, how new and delete operator works in c++, how to allocate memory using new and how to deallocate or free memory using free in c++ with examples.
source code for this tutorial
#includeusing namespace std; int main() { int *pointer = nullptr; cout << "how many items u are gonna enter"< > input; pointer = new int[input]; int temp; for(int counter =0; counter < input ; counter++){ cout << "enter the item "< > temp; *(pointer+counter) = temp; } cout << "the items you have entered are"<