COMP 206 Lecture Notes - Lecture 25: Object-Oriented Programming, Function Pointer, C Dynamic Memory Allocation

31 views1 pages

Document Summary

Declaration char all_memory[1000000]; int main() int *array = (int*) malloc(1000*sizeof(int)); array[0] = 5; array[999] = 5; int *array2 = &(all_memory[5000]); The power that malloc gives us is the power to scale memory usage of programs dynamically. Without malloc, we must dedicate large amounts of memory to running even the smallest programs. Linked lists start with pointer and end with null. Each item in the list is called a node. All of a progra(cid:373)"s code live i(cid:374) (cid:373)e(cid:373)ory c gives us access that that memory using pointers. In addition to pointing to data, we can also point to functions. These include those we code ourselves, and built-in functions in libraries.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents