0% found this document useful (0 votes)
22 views6 pages

Dynamic Memory Allocation Explained

This document discusses dynamic memory allocation in C/C++. It explains that dynamic memory allocation allows memory to be allocated at runtime using operators like new and delete. This is in contrast to static memory allocation where the size is fixed at compile time. The document also demonstrates how to create dynamically allocated arrays, including 1D and 2D arrays, and shows how to allocate memory for them using new and delete.

Uploaded by

Aman Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views6 pages

Dynamic Memory Allocation Explained

This document discusses dynamic memory allocation in C/C++. It explains that dynamic memory allocation allows memory to be allocated at runtime using operators like new and delete. This is in contrast to static memory allocation where the size is fixed at compile time. The document also demonstrates how to create dynamically allocated arrays, including 1D and 2D arrays, and shows how to allocate memory for them using new and delete.

Uploaded by

Aman Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Dynamic Memory

Allocation [Part -2]

[Link]
int arr (5) [ 5) int arr [ to ]
udo , 2 > u
08

? dynamic
new
1
int * an -_ new int 403;
2
d
3

y
Variable / Uses vote
runtime

news

.¥ads L int mini

^↳ ?
oh > >m
>> n
;

im-¥
2D
array

int
arent ✗ BAD BAD ✗
•-☐
4

can
EE
ynem÷°Y
2DñgTY[rnntim①

user
ip

int*ax=ivwint[n]#
=

iÉ---
an [ 3][ 4]
mm

ie→
¥
'
2
Daffy

It
int •
az=new-Ln]

int*•angnewint*[n#
"

÷÷7Éi ☒

2¥ ¥
[ ] Ln ]

iu¥i
an n
;
-

=⑦

iu→•an=nwint*_[n#*→
For ( ]
{
[i] =

newintnd;

[Link]#amD---
an

3

Heap → memory
use

↳ Koon
jab hozaep
h
memory fneframdy)
Visualisation
Zan÷
into →

intro →

into →

int * →

Momk -

jagged;ay
dynamic
memory
111ocation

You might also like