MAT 21B Lecture 21: Lecture 21
Lecture 21
Dynamic memory allocation
Free()
- Void free()
o Provided by header stdlib.h
o Frees allocate area pointer by ptr
Calloc()
- Malloc() only allocates certain number of bytes
- Calloc() allocates certain number of item
3 phase schemes
- Allocation of data
- Computation involving data
- Free data
Realloc()
- Increase and decrease size of space pointed by prt
-
- Useful approach for dynamic arrays
See powerpoint for 1D array, 2D array and string
Below is from powerpoint reference:
beigecamel74 and 41 others unlocked
83
MAT 21B Full Course Notes
Verified Note
83 documents