Hi, folks, let's start today's session, not today's topic is new and delete operators in TPP.
So before moving forward, let's discuss about the dynamic memory allocation and dynamic memory allocation,
because new and delete operators are just the implementation of both of these concepts.
So dynamic memory allocation is a concept that programmers manually allocate a memory to a particular
variable like dynamic memory.
The allocation is a concept where a definite component of memory, which was allotted to a particular
variable using dynamic memory allocation, is released dynamically.
Example of automatic memory allocation and the allocation is the electricity here in automatic memory
allocation.
It's the responsibility of the compiler to allocate and release this particular memory automatically.
Right.
In case of dynamic memory allocation, the I like a particular amount of memory here we are assigning
two byte.
To this particular variable using Newquay word, so it's the case of dynamic memory allocation.
So it's the responsibility of the programmer to educate and develop, that means to release this particular
memory dynamically.
Now let's discuss about the new and delete operators.
So new operators are used to allocate this particular memory dynamically.
So new operators, as shown in this particular example, is used to allocate this Intisar type memory
to this particular variable.
Why delete?
Delete is used dynamically allocate the memory assigned to a particular variable using a new operator.
Now let's move forward with the coding.
But so here we have a simple representation of main function.
Now, let's create the point that variable.
Into point thirty here, we will create and assign a value to this dynamically now before going to the
line number seven, since they want to release this particular memory allocated to point to variable
variability, we will use the keyword and delete and will release this using the LATAPY.
So here what we are doing is we are just assigning the variable, assigning a memory to this variable
particular pointer, be using new keyword dynamically.
So it's a case of dynamic
memory.
Allocation Garchik,
I have some mistakes.
Yup, so here we have a simpler case of a dynamic allocation and.
Since we since we are using the key word here, so it's a case of dynamic memory, be a location.
So that's all about new and delete operators.
Thanks for watching.