MAT 21B Lecture 21: Lecture 21
![](https://new-preview-html.oneclass.com/B31JpRdK5Xvqm32ewRbwQE682ManP94A/bg1.png)
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:
![MAT 21B Full Course Notes](https://new-docs-thumbs.oneclass.com/doc_thumbnails/list_view/2365737-class-notes-us-uc-davis-mat-21b-lecture13.jpg)
83
MAT 21B Full Course Notes
Verified Note
83 documents